mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-22 15:47:41 +00:00
Updated various places in Keyman Developer to show the full VersionWithTag rather than the short version number we had been previously showing: - About dialog - Welcome screen - Installer - kmcomp help - kmconvert help - kmanalyze help - kmdecomp help This should help when testing to verify that we are testing the right version. Also fixed the keymansentry path when running command line C++ programs from source repo.
100 lines
2.4 KiB
ObjectPascal
100 lines
2.4 KiB
ObjectPascal
unit Keyman.Developer.System.Project.WelcomeRenderer;
|
|
|
|
interface
|
|
|
|
type
|
|
TWelcomeRenderer = class
|
|
class function Render: string;
|
|
class function ProjectMRUFilename: string;
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
System.SysUtils,
|
|
Winapi.msxml,
|
|
Winapi.Shlobj,
|
|
Xml.Win.msxmldom,
|
|
|
|
KeymanVersion,
|
|
Keyman.Developer.System.Project.ProjectFile,
|
|
Keyman.Developer.System.Project.UrlRenderer,
|
|
RegistryKeys,
|
|
VersionInfo,
|
|
utilsystem;
|
|
|
|
class function TWelcomeRenderer.ProjectMRUFilename: string;
|
|
var
|
|
path: string;
|
|
const
|
|
SMRUFilename = 'project_mru.xml';
|
|
begin
|
|
// Keyman Developer 14 omitted the backslash in the file path
|
|
// so it was saving this file in the wrong location. This small patch
|
|
// moves the file into the right location.
|
|
path := GetFolderPath(CSIDL_APPDATA) + SFolderKeymanDeveloper;
|
|
if FileExists(path + SMRUFilename) then
|
|
begin
|
|
if not DirectoryExists(path) then
|
|
CreateDir(path);
|
|
if FileExists(path + '\' + SMRuFilename)
|
|
then DeleteFile(path + SMRUFilename)
|
|
else RenameFile(path + SMRUFilename, path + '\' + SMRUFilename);
|
|
end;
|
|
// end patch
|
|
|
|
Result := path + '\' + SMRUFilename;
|
|
end;
|
|
|
|
class function TWelcomeRenderer.Render: string;
|
|
var
|
|
node, root: IXMLDOMElement;
|
|
doc, xsl: IXMLDomDocument;
|
|
FLastDir: string;
|
|
begin
|
|
FLastDir := GetCurrentDir;
|
|
SetCurrentDir(TProject.StringsTemplatePath);
|
|
try
|
|
doc := MSXMLDOMDocumentFactory.CreateDOMDocument;
|
|
try
|
|
doc.async := False;
|
|
if FileExists(ProjectMRUFilename) then
|
|
begin
|
|
doc.load(ProjectMRUFilename);
|
|
root := doc.createElement('Data');
|
|
node := doc.documentElement;
|
|
doc.documentElement := root;
|
|
root.appendChild(node);
|
|
end
|
|
else
|
|
begin
|
|
doc.loadXML('<Data><MRU /></Data>');
|
|
root := doc.documentElement;
|
|
end;
|
|
|
|
node := doc.createElement('Version');
|
|
node.appendChild(doc.createTextNode(CKeymanVersionInfo.VersionWithTag));
|
|
root.appendChild(node);
|
|
|
|
TProjectUrlRenderer.AddUrls(root);
|
|
|
|
xsl := MSXMLDOMDocumentFactory.CreateDOMDocument;
|
|
try
|
|
xsl.async := False;
|
|
xsl.resolveExternals := True;
|
|
xsl.validateOnParse := False;
|
|
xsl.load(TProject.StringsTemplatePath + 'globalwelcome.xsl');
|
|
|
|
Result := doc.transformNode(xsl);
|
|
finally
|
|
xsl := nil;
|
|
end;
|
|
finally
|
|
doc := nil;
|
|
end;
|
|
finally
|
|
SetCurrentDir(FLastDir);
|
|
end;
|
|
end;
|
|
|
|
end.
|