IDE: Fix ProductVersion logic in ProjectVersionInfo. Patch from Dmitry D. Chernov.

git-svn-id: trunk@55968 -
This commit is contained in:
juha 2017-10-03 18:19:51 +00:00
parent 091c73c8e7
commit 48558bcd40

View File

@ -422,19 +422,16 @@ begin
end; end;
end; end;
procedure TProjectVersionInfo.WriteToProjectFile(AConfig: TObject; procedure TProjectVersionInfo.WriteToProjectFile(AConfig: TObject; const Path: string);
const Path: string);
var var
i: integer; i: integer;
Key: string; Key: string;
DefaultValue: String;
attr: TProjectVersionAttribute; attr: TProjectVersionAttribute;
begin begin
with TXMLConfig(AConfig) do with TXMLConfig(AConfig) do
begin begin
SetDeleteValue(Path + 'VersionInfo/UseVersionInfo/Value', UseVersionInfo, False); SetDeleteValue(Path + 'VersionInfo/UseVersionInfo/Value', UseVersionInfo, False);
SetDeleteValue(Path + 'VersionInfo/AutoIncrementBuild/Value', SetDeleteValue(Path + 'VersionInfo/AutoIncrementBuild/Value', AutoIncrementBuild, False);
AutoIncrementBuild, False);
SetDeleteValue(Path + 'VersionInfo/MajorVersionNr/Value', MajorVersionNr, 0); SetDeleteValue(Path + 'VersionInfo/MajorVersionNr/Value', MajorVersionNr, 0);
SetDeleteValue(Path + 'VersionInfo/MinorVersionNr/Value', MinorVersionNr, 0); SetDeleteValue(Path + 'VersionInfo/MinorVersionNr/Value', MinorVersionNr, 0);
SetDeleteValue(Path + 'VersionInfo/RevisionNr/Value', RevisionNr, 0); SetDeleteValue(Path + 'VersionInfo/RevisionNr/Value', RevisionNr, 0);
@ -452,17 +449,12 @@ begin
for i := 0 to StringTable.Count - 1 do begin for i := 0 to StringTable.Count - 1 do begin
Key:=StringTable.Keys[i]; Key:=StringTable.Keys[i];
if Key='FileVersion' then continue; // FileVersion is created automatically if Key='FileVersion' then continue; // FileVersion is created automatically
DefaultValue:=''; SetDeleteValue(Path + 'VersionInfo/StringTable/' + Key, StringTable.ValuesByIndex[i], '');
if (Key='ProductVersion') then
DefaultValue:=BuildFileVersionString;
SetDeleteValue(Path + 'VersionInfo/StringTable/' + StringTable.Keys[i],
StringTable.ValuesByIndex[i],DefaultValue);
end; end;
end; end;
end; end;
procedure TProjectVersionInfo.ReadFromProjectFile(AConfig: TObject; procedure TProjectVersionInfo.ReadFromProjectFile(AConfig: TObject; const Path: string);
const Path: string);
var var
i: integer; i: integer;
Node: TDomNode; Node: TDomNode;
@ -519,7 +511,7 @@ begin
StringTable['LegalTrademarks'] := GetValue(Path + 'VersionInfo/LegalTrademarks/Value', ''); StringTable['LegalTrademarks'] := GetValue(Path + 'VersionInfo/LegalTrademarks/Value', '');
StringTable['OriginalFilename'] := GetValue(Path + 'VersionInfo/OriginalFilename/Value', ''); StringTable['OriginalFilename'] := GetValue(Path + 'VersionInfo/OriginalFilename/Value', '');
StringTable['ProductName'] := GetValue(Path + 'VersionInfo/ProductName/Value', ''); StringTable['ProductName'] := GetValue(Path + 'VersionInfo/ProductName/Value', '');
StringTable['ProductVersion'] := GetValue(Path + 'VersionInfo/ProjectVersion/Value', BuildFileVersionString); StringTable['ProductVersion'] := GetValue(Path + 'VersionInfo/ProductVersion/Value', BuildFileVersionString);
end; end;
SetFileVersionFromVersion; SetFileVersionFromVersion;