mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 18:09:30 +02:00
* Only save new config-files when the version is updated or the file is newly created
git-svn-id: trunk@15914 -
This commit is contained in:
parent
65ab1e820b
commit
4cb34b50f3
@ -97,7 +97,7 @@ begin
|
||||
if not GeneratedConfig then
|
||||
begin
|
||||
GlobalOptions.LoadGlobalFromFile(cfgfile);
|
||||
if GlobalOptions.Dirty and (not UseGlobalConfig or IsSuperUser) then
|
||||
if GlobalOptions.SaveInifileChanges and (not UseGlobalConfig or IsSuperUser) then
|
||||
GlobalOptions.SaveGlobalToFile(cfgfile);
|
||||
end;
|
||||
GlobalOptions.CompilerConfig:=GlobalOptions.DefaultCompilerConfig;
|
||||
@ -139,7 +139,7 @@ begin
|
||||
pkgglobals.Log(vlDebug,SLogGeneratingCompilerConfig,[S]);
|
||||
CompilerOptions.InitCompilerDefaults;
|
||||
CompilerOptions.SaveCompilerToFile(S);
|
||||
if CompilerOptions.Dirty then
|
||||
if CompilerOptions.SaveInifileChanges then
|
||||
CompilerOptions.SaveCompilerToFile(S);
|
||||
end
|
||||
else
|
||||
@ -154,7 +154,7 @@ begin
|
||||
begin
|
||||
pkgglobals.Log(vlDebug,SLogLoadingFPMakeCompilerConfig,[S]);
|
||||
FPMakeCompilerOptions.LoadCompilerFromFile(S);
|
||||
if FPMakeCompilerOptions.Dirty then
|
||||
if FPMakeCompilerOptions.SaveInifileChanges then
|
||||
FPMakeCompilerOptions.SaveCompilerToFile(S);
|
||||
end
|
||||
else
|
||||
|
@ -32,7 +32,7 @@ Type
|
||||
|
||||
TGlobalOptions = Class(TPersistent)
|
||||
private
|
||||
FDirty : Boolean;
|
||||
FSaveInifileChanges : Boolean;
|
||||
FConfigVersion : Integer;
|
||||
FRemoteMirrorsURL,
|
||||
FRemoteRepository,
|
||||
@ -60,7 +60,8 @@ Type
|
||||
Procedure LoadGlobalFromFile(const AFileName : String);
|
||||
Procedure SaveGlobalToFile(const AFileName : String);
|
||||
procedure LogValues;
|
||||
Property Dirty : Boolean Read FDirty;
|
||||
// Is set when the inifile has an old version number (which is also the case when a new file is generated)
|
||||
Property SaveInifileChanges : Boolean Read FSaveInifileChanges;
|
||||
Property ConfigVersion : Integer read FConfigVersion;
|
||||
function LocalPackagesFile:string;
|
||||
function LocalMirrorsFile:string;
|
||||
@ -89,7 +90,7 @@ Type
|
||||
|
||||
TCompilerOptions = Class(TPersistent)
|
||||
private
|
||||
FDirty: Boolean;
|
||||
FSaveInifileChanges: Boolean;
|
||||
FConfigVersion : Integer;
|
||||
FCompiler,
|
||||
FCompilerVersion,
|
||||
@ -115,7 +116,8 @@ Type
|
||||
Function LocalUnitDir:string;
|
||||
Function GlobalUnitDir:string;
|
||||
Function HasOptions: boolean;
|
||||
Property Dirty : Boolean Read FDirty;
|
||||
// Is set when the inifile has an old version number (which is also the case when a new file is generated)
|
||||
Property SaveInifileChanges : Boolean Read FSaveInifileChanges;
|
||||
Property ConfigVersion : Integer read FConfigVersion;
|
||||
Published
|
||||
Property Compiler : String Index 1 Read GetOptString Write SetOptString;
|
||||
@ -230,7 +232,6 @@ begin
|
||||
else
|
||||
Error('Unknown option');
|
||||
end;
|
||||
FDirty:=True;
|
||||
end;
|
||||
|
||||
|
||||
@ -312,7 +313,7 @@ begin
|
||||
if (FConfigVersion<>CurrentConfigVersion) then
|
||||
begin
|
||||
Log(vlDebug,SLogUpgradingConfig,[AFileName]);
|
||||
FDirty:=true;
|
||||
FSaveInifileChanges:=true;
|
||||
if FConfigVersion<1 then
|
||||
begin
|
||||
FRemoteRepository:='auto';
|
||||
@ -364,7 +365,7 @@ begin
|
||||
WriteString(SDefaults,KeyCompilerConfig,FDefaultCompilerConfig);
|
||||
WriteString(SDefaults,KeyFPMakeCompilerConfig,FFPMakeCompilerConfig);
|
||||
WriteString(SDefaults,KeyDownloader,FDownloader);
|
||||
FDirty:=False;
|
||||
FSaveInifileChanges:=False;
|
||||
end;
|
||||
Ini.UpdateFile;
|
||||
finally
|
||||
@ -445,7 +446,6 @@ begin
|
||||
else
|
||||
Error('Unknown option');
|
||||
end;
|
||||
FDirty:=True;
|
||||
end;
|
||||
|
||||
|
||||
@ -454,7 +454,6 @@ begin
|
||||
if FCompilerCPU=AValue then
|
||||
exit;
|
||||
FCompilerCPU:=AValue;
|
||||
FDirty:=True;
|
||||
end;
|
||||
|
||||
|
||||
@ -469,7 +468,6 @@ begin
|
||||
if FCompilerOS=AValue then
|
||||
exit;
|
||||
FCompilerOS:=AValue;
|
||||
FDirty:=True;
|
||||
end;
|
||||
|
||||
|
||||
@ -563,7 +561,7 @@ begin
|
||||
if (FConfigVersion<>CurrentConfigVersion) then
|
||||
begin
|
||||
Log(vlDebug,SLogUpgradingConfig,[AFileName]);
|
||||
FDirty:=true;
|
||||
FSaveInifileChanges:=true;
|
||||
if (FConfigVersion>CurrentConfigVersion) then
|
||||
Error(SErrUnsupportedConfigVersion,[AFileName]);
|
||||
end;
|
||||
@ -597,7 +595,7 @@ begin
|
||||
WriteString(SDefaults,KeyCompilerOS,OSToString(CompilerOS));
|
||||
WriteString(SDefaults,KeyCompilerCPU,CPUtoString(CompilerCPU));
|
||||
WriteString(SDefaults,KeyCompilerVersion,FCompilerVersion);
|
||||
FDirty:=False;
|
||||
FSaveInifileChanges:=False;
|
||||
end;
|
||||
Ini.UpdateFile;
|
||||
finally
|
||||
|
Loading…
Reference in New Issue
Block a user