mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-02 08:59:35 +01:00
IDE: started path delim saving in projects/packages
git-svn-id: trunk@18137 -
This commit is contained in:
parent
56d598901b
commit
e768bb58c3
@ -62,8 +62,10 @@ type
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Assign(Source: TLazBuildMode); override;
|
||||
procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string; DoSwitchPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string);
|
||||
procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string;
|
||||
DoSwitchPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string;
|
||||
UsePathDelim: TPathDelimSwitch);
|
||||
procedure CreateDiff(OtherMode: TLazBuildMode; Tool: TCompilerDiffTool);
|
||||
procedure Assign(Source: TIDEBuildMode);
|
||||
end;
|
||||
@ -90,8 +92,10 @@ type
|
||||
function IndexOfIdentifier(Identifier: string): integer; override;
|
||||
function ModeWithIdentifier(Identifier: string): TIDEBuildMode; override;
|
||||
procedure Move(OldIndex, NewIndex: integer); override;
|
||||
procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string; DoSwitchPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string);
|
||||
procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string;
|
||||
DoSwitchPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string;
|
||||
UsePathDelim: TPathDelimSwitch);
|
||||
procedure CreateDiff(OtherModes: TLazBuildModes; Tool: TCompilerDiffTool);
|
||||
procedure Assign(Source: TLazBuildModes);
|
||||
property BuildModeSet: TBuildModeSet read FBuildModeSet write SetBuildModeSet;// active in BuildModeSet
|
||||
@ -303,7 +307,8 @@ type
|
||||
procedure Assign(Src: TCompilationToolOptions); virtual;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
DoSwitchPathDelims: boolean); virtual;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); virtual;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
UsePathDelim: TPathDelimSwitch); virtual;
|
||||
procedure CreateDiff(CompOpts: TCompilationToolOptions;
|
||||
Tool: TCompilerDiffTool); virtual;
|
||||
function Execute(const WorkingDir, ToolTitle: string): TModalResult;
|
||||
@ -323,6 +328,7 @@ type
|
||||
fLoaded: Boolean;
|
||||
fOptionsString: String;
|
||||
FParsedOpts: TParsedCompilerOptions;
|
||||
FStorePathDelim: TPathDelimSwitch;
|
||||
fTargetFilename: string;
|
||||
fXMLFile: String;
|
||||
FXMLConfig: TXMLConfig;
|
||||
@ -441,6 +447,7 @@ type
|
||||
property XMLFile: String read fXMLFile write fXMLFile;
|
||||
property XMLConfigFile: TXMLConfig read FXMLConfig write FXMLConfig;
|
||||
property Loaded: Boolean read fLoaded write fLoaded;
|
||||
property StorePathDelim: TPathDelimSwitch read FStorePathDelim write FStorePathDelim;
|
||||
|
||||
// compilation
|
||||
property CompilerPath: String read fCompilerPath write SetCompilerPath;
|
||||
@ -487,7 +494,8 @@ type
|
||||
procedure Clear;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
AdjustPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
UsePathDelim: TPathDelimSwitch);
|
||||
function GetOwnerName: string; virtual;
|
||||
function GetOption(AnOption: TInheritedCompilerOption): string;
|
||||
public
|
||||
@ -1100,8 +1108,8 @@ var
|
||||
begin
|
||||
{ Load the compiler options from the XML file }
|
||||
p:=Path;
|
||||
PathDelimChange:=XMLConfigFile.GetValue(p+'PathDelim/Value', '/')<>PathDelim;
|
||||
FileVersion:=XMLConfigFile.GetValue(p+'Version/Value', 0);
|
||||
StorePathDelim:=CheckPathDelim(XMLConfigFile.GetValue(p+'PathDelim/Value', '/'),PathDelimChange);
|
||||
|
||||
{ Target }
|
||||
p:=Path+'Target/';
|
||||
@ -1113,13 +1121,14 @@ begin
|
||||
Libraries := sp(XMLConfigFile.GetValue(p+'Libraries/Value', ''));
|
||||
OtherUnitFiles := sp(XMLConfigFile.GetValue(p+'OtherUnitFiles/Value', ''));
|
||||
UnitOutputDirectory := sp(XMLConfigFile.GetValue(p+'UnitOutputDirectory/Value', ''));
|
||||
LCLWidgetType := XMLConfigFile.GetValue(p+'LCLWidgetType/Value', '');
|
||||
ObjectPath := sp(XMLConfigFile.GetValue(p+'ObjectPath/Value', ''));
|
||||
SrcPath := sp(XMLConfigFile.GetValue(p+'SrcPath/Value', ''));
|
||||
|
||||
{ Conditionals }
|
||||
TCompOptConditionals(FConditionals).LoadFromXMLConfig(XMLConfigFile,
|
||||
Path+'Conditionals/',PathDelimChange);
|
||||
// ToDo: replace this with conditional compiler options
|
||||
LCLWidgetType := XMLConfigFile.GetValue(p+'LCLWidgetType/Value', '');
|
||||
|
||||
{ Parsing }
|
||||
p:=Path+'Parsing/';
|
||||
@ -1271,31 +1280,42 @@ end;
|
||||
TfrmCompilerOptions SaveTheCompilerOptions
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TBaseCompilerOptions.SaveTheCompilerOptions(const Path: string);
|
||||
var
|
||||
UsePathDelim: TPathDelimSwitch;
|
||||
|
||||
function f(const AFilename: string): string;
|
||||
begin
|
||||
Result:=SwitchPathDelims(AFilename,UsePathDelim);
|
||||
end;
|
||||
|
||||
var
|
||||
P: string;
|
||||
begin
|
||||
{ Save the compiler options to the XML file }
|
||||
p:=Path;
|
||||
UsePathDelim:=pdsNone;
|
||||
XMLConfigFile.SetValue(p+'Version/Value', CompilerOptionsVersion);
|
||||
XMLConfigFile.SetDeleteValue(p+'PathDelim/Value', PathDelim, '/');
|
||||
XMLConfigFile.SetDeleteValue(p+'PathDelim/Value',
|
||||
PathDelimSwitchToDelim[UsePathDelim], '/');
|
||||
|
||||
{ Target }
|
||||
p:=Path+'Target/';
|
||||
XMLConfigFile.SetDeleteValue(p+'Filename/Value', TargetFilename,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'Filename/Value', f(TargetFilename),'');
|
||||
|
||||
{ SearchPaths }
|
||||
p:=Path+'SearchPaths/';
|
||||
XMLConfigFile.SetDeleteValue(p+'IncludeFiles/Value', IncludePath,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'Libraries/Value', Libraries,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'OtherUnitFiles/Value', OtherUnitFiles,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'UnitOutputDirectory/Value', UnitOutputDirectory,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'LCLWidgetType/Value', LCLWidgetType,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'ObjectPath/Value', ObjectPath,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'SrcPath/Value', SrcPath,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'IncludeFiles/Value', f(IncludePath),'');
|
||||
XMLConfigFile.SetDeleteValue(p+'Libraries/Value', f(Libraries),'');
|
||||
XMLConfigFile.SetDeleteValue(p+'OtherUnitFiles/Value', f(OtherUnitFiles),'');
|
||||
XMLConfigFile.SetDeleteValue(p+'UnitOutputDirectory/Value', f(UnitOutputDirectory),'');
|
||||
XMLConfigFile.SetDeleteValue(p+'ObjectPath/Value', f(ObjectPath),'');
|
||||
XMLConfigFile.SetDeleteValue(p+'SrcPath/Value', f(SrcPath),'');
|
||||
|
||||
{ Conditionals }
|
||||
TCompOptConditionals(FConditionals).SaveToXMLConfig(XMLConfigFile,
|
||||
Path+'Conditionals/');
|
||||
Path+'Conditionals/',UsePathDelim);
|
||||
// ToDo: remove
|
||||
XMLConfigFile.SetDeleteValue(p+'LCLWidgetType/Value', LCLWidgetType,'');
|
||||
|
||||
{ Parsing }
|
||||
p:=Path+'Parsing/';
|
||||
@ -1326,10 +1346,10 @@ begin
|
||||
XMLConfigFile.SetDeleteValue(p+'SmallerCode/Value', SmallerCode, false);
|
||||
XMLConfigFile.SetDeleteValue(p+'TargetProcessor/Value', TargetProcessor,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'TargetCPU/Value', TargetCPU,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'TargetOS/Value', TargetOS,'');
|
||||
XMLConfigFile.SetDeleteValue(p+'Optimizations/VariablesInRegisters/Value', VariablesInRegisters,false);
|
||||
XMLConfigFile.SetDeleteValue(p+'Optimizations/UncertainOptimizations/Value', UncertainOptimizations,false);
|
||||
XMLConfigFile.SetDeleteValue(p+'Optimizations/OptimizationLevel/Value', OptimizationLevel,1);
|
||||
XMLConfigFile.SetDeleteValue(p+'TargetOS/Value', TargetOS,'');
|
||||
|
||||
{ Linking }
|
||||
p:=Path+'Linking/';
|
||||
@ -1343,7 +1363,7 @@ begin
|
||||
XMLConfigFile.SetDeleteValue(p+'LinkSmart/Value', LinkSmart,false);
|
||||
XMLConfigFile.SetDeleteValue(p+'Options/PassLinkerOptions/Value', PassLinkerOptions,false);
|
||||
XMLConfigFile.SetDeleteValue(p+'Options/LinkerOptions/Value',
|
||||
LineBreaksToSystemLineBreaks(LinkerOptions),'');
|
||||
f(LineBreaksToSystemLineBreaks(LinkerOptions)),'');
|
||||
XMLConfigFile.SetDeleteValue(p+'Options/Win32/GraphicApplication/Value', Win32GraphicApp,false);
|
||||
XMLConfigFile.SetDeleteValue(p+'Options/ExecutableType/Value',
|
||||
CompilationExecutableTypeNames[ExecutableType],
|
||||
@ -1378,14 +1398,14 @@ begin
|
||||
p:=Path+'Other/';
|
||||
XMLConfigFile.SetDeleteValue(p+'ConfigFile/DontUseConfigFile/Value', DontUseConfigFile,false);
|
||||
XMLConfigFile.SetDeleteValue(p+'ConfigFile/CustomConfigFile/Value', CustomConfigFile,false);
|
||||
XMLConfigFile.SetDeleteValue(p+'ConfigFile/ConfigFilePath/Value', ConfigFilePath,'extrafpc.cfg');
|
||||
XMLConfigFile.SetDeleteValue(p+'ConfigFile/ConfigFilePath/Value', f(ConfigFilePath),'extrafpc.cfg');
|
||||
XMLConfigFile.SetDeleteValue(p+'CustomOptions/Value',
|
||||
LineBreaksToSystemLineBreaks(CustomOptions),'');
|
||||
f(LineBreaksToSystemLineBreaks(CustomOptions)),'');
|
||||
|
||||
{ Compilation }
|
||||
XMLConfigFile.SetDeleteValue(p+'CompilerPath/Value', CompilerPath,'');
|
||||
ExecuteBefore.SaveToXMLConfig(XMLConfigFile,p+'ExecuteBefore/');
|
||||
ExecuteAfter.SaveToXMLConfig(XMLConfigFile,p+'ExecuteAfter/');
|
||||
XMLConfigFile.SetDeleteValue(p+'CompilerPath/Value', f(CompilerPath),'');
|
||||
ExecuteBefore.SaveToXMLConfig(XMLConfigFile,p+'ExecuteBefore/',UsePathDelim);
|
||||
ExecuteAfter.SaveToXMLConfig(XMLConfigFile,p+'ExecuteAfter/',UsePathDelim);
|
||||
XMLConfigFile.SetDeleteValue(p+'CreateMakefileOnBuild/Value',
|
||||
CreateMakefileOnBuild,false);
|
||||
|
||||
@ -2584,6 +2604,7 @@ begin
|
||||
fLoaded := CompOpts.fLoaded;
|
||||
|
||||
// Search Paths
|
||||
StorePathDelim := CompOpts.StorePathDelim;
|
||||
IncludePath := CompOpts.fIncludePaths;
|
||||
Libraries := CompOpts.fLibraryPaths;
|
||||
OtherUnitFiles := CompOpts.fUnitPaths;
|
||||
@ -2706,6 +2727,9 @@ procedure TBaseCompilerOptions.CreateDiff(CompOpts: TBaseCompilerOptions;
|
||||
end;
|
||||
|
||||
begin
|
||||
Tool.AddPathsDiff('StorePathDelim',PathDelimSwitchToDelim[FStorePathDelim],
|
||||
PathDelimSwitchToDelim[CompOpts.FStorePathDelim]);
|
||||
|
||||
// search paths
|
||||
Tool.Path:='Paths';
|
||||
Tool.AddPathsDiff('IncludePaths',fIncludePaths,CompOpts.fIncludePaths);
|
||||
@ -2717,6 +2741,7 @@ begin
|
||||
Tool.AddPathsDiff('DebugPath',fDebugPath,CompOpts.fDebugPath);
|
||||
|
||||
// conditionals
|
||||
Tool.Path:='Conditionals';
|
||||
TCompOptConditionals(Conditionals).CreateDiff(CompOpts.Conditionals,Tool);
|
||||
TIDEBuildModes(fBuildModes).CreateDiff(CompOpts.BuildModes,Tool);
|
||||
Tool.AddDiff('LCLWidgetType',fLCLWidgetType,CompOpts.fLCLWidgetType);
|
||||
@ -2909,7 +2934,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TAdditionalCompilerOptions.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
const Path: string; UsePathDelim: TPathDelimSwitch);
|
||||
begin
|
||||
XMLConfig.SetDeleteValue(Path+'CustomOptions/Value',fCustomOptions,'');
|
||||
XMLConfig.SetDeleteValue(Path+'IncludePath/Value',FIncludePath,'');
|
||||
@ -2917,7 +2942,7 @@ begin
|
||||
XMLConfig.SetDeleteValue(Path+'LinkerOptions/Value',fLinkerOptions,'');
|
||||
XMLConfig.SetDeleteValue(Path+'ObjectPath/Value',FObjectPath,'');
|
||||
XMLConfig.SetDeleteValue(Path+'UnitPath/Value',FUnitPath,'');
|
||||
FConditionals.SaveToXMLConfig(XMLConfig,Path+'Conditionals/');
|
||||
FConditionals.SaveToXMLConfig(XMLConfig,Path+'Conditionals/',UsePathDelim);
|
||||
end;
|
||||
|
||||
function TAdditionalCompilerOptions.GetOwnerName: string;
|
||||
@ -3172,9 +3197,10 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCompilationToolOptions.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
const Path: string; UsePathDelim: TPathDelimSwitch);
|
||||
begin
|
||||
XMLConfig.SetDeleteValue(Path+'Command/Value',Command,'');
|
||||
XMLConfig.SetDeleteValue(Path+'Command/Value',
|
||||
SwitchPathDelims(Command,UsePathDelim),'');
|
||||
XMLConfig.SetDeleteValue(Path+'ScanForFPCMsgs/Value',
|
||||
ScanForFPCMessages,false);
|
||||
XMLConfig.SetDeleteValue(Path+'ScanForMakeMsgs/Value',
|
||||
@ -3357,13 +3383,14 @@ begin
|
||||
end;
|
||||
|
||||
procedure TIDEBuildMode.SaveToXMLConfig(AXMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
const Path: string; UsePathDelim: TPathDelimSwitch);
|
||||
begin
|
||||
AXMLConfig.SetDeleteValue(Path+'Identifier/Value',FIdentifier,'');
|
||||
AXMLConfig.SetDeleteValue(Path+'Description/Value',FDescription,'');
|
||||
SaveStringList(AXMLConfig,FValues,Path+'Values/');
|
||||
SaveStringList(AXMLConfig,FValueDescriptions,Path+'ValueDescriptions/');
|
||||
TCompOptConditionals(FDefaultValue).SaveToXMLConfig(AXMLConfig,Path+'DefaultValue');
|
||||
TCompOptConditionals(FDefaultValue).SaveToXMLConfig(AXMLConfig,Path+'DefaultValue',
|
||||
UsePathDelim);
|
||||
end;
|
||||
|
||||
procedure TIDEBuildMode.CreateDiff(OtherMode: TLazBuildMode;
|
||||
@ -3492,13 +3519,14 @@ begin
|
||||
end;
|
||||
|
||||
procedure TIDEBuildModes.SaveToXMLConfig(AXMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
const Path: string; UsePathDelim: TPathDelimSwitch);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
AXMLConfig.SetDeleteValue(Path+'Count/Value',Count,0);
|
||||
for i:=0 to Count-1 do
|
||||
TIDEBuildMode(Items[i]).SaveToXMLConfig(AXMLConfig,Path+'Item'+IntToStr(i+1)+'/');
|
||||
TIDEBuildMode(Items[i]).SaveToXMLConfig(AXMLConfig,
|
||||
Path+'Item'+IntToStr(i+1)+'/',UsePathDelim);
|
||||
end;
|
||||
|
||||
procedure TIDEBuildModes.CreateDiff(OtherModes: TLazBuildModes;
|
||||
|
||||
@ -94,7 +94,8 @@ type
|
||||
Tool: TCompilerDiffTool); virtual;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
DoSwitchPathDelims: boolean); virtual;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); virtual;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
UsePathDelim: TPathDelimSwitch); virtual;
|
||||
property Values[ValueType: TCOCValueType]: string read GetValues;
|
||||
property Evaluator: TExpressionEvaluator read FEvaluator write SetEvaluator;
|
||||
property ChangeStamp: integer read FChangeStamp;
|
||||
@ -313,11 +314,13 @@ procedure TCompOptConditionals.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
NewCount: LongInt;
|
||||
i: Integer;
|
||||
NewChild: TCompOptCondNode;
|
||||
s: String;
|
||||
begin
|
||||
Node.ClearNodes;
|
||||
Node.NodeType:=COCNodeTypeNameToType(XMLConfig.GetValue(SubPath+'NodeType',''));
|
||||
Node.ValueType:=COCValueTypeNameToType(XMLConfig.GetValue(SubPath+'ValueType',''));
|
||||
Node.Value:=XMLConfig.GetValue(SubPath+'Value','');
|
||||
s:=XMLConfig.GetValue(SubPath+'Value','');
|
||||
Node.Value:=SwitchPathDelims(s,DoSwitchPathDelims);
|
||||
// load childs
|
||||
NewCount:=XMLConfig.GetValue(SubPath+'ChildCount',0);
|
||||
for i:=1 to NewCount do begin
|
||||
@ -335,17 +338,19 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCompOptConditionals.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
const Path: string; UsePathDelim: TPathDelimSwitch);
|
||||
|
||||
procedure SaveNode(Node: TCompOptCondNode; const SubPath: string);
|
||||
var
|
||||
i: Integer;
|
||||
s: String;
|
||||
begin
|
||||
XMLConfig.SetDeleteValue(SubPath+'NodeType',COCNodeTypeNames[Node.NodeType],
|
||||
COCNodeTypeNames[cocntNone]);
|
||||
XMLConfig.SetDeleteValue(SubPath+'ValueType',COCValueTypeNames[Node.ValueType],
|
||||
COCValueTypeNames[cocvtNone]);
|
||||
XMLConfig.SetDeleteValue(SubPath+'Value',Node.Value,'');
|
||||
s:=SwitchPathDelims(Node.Value,UsePathDelim);
|
||||
XMLConfig.SetDeleteValue(SubPath+'Value',s,'');
|
||||
// save childs
|
||||
XMLConfig.SetDeleteValue(SubPath+'ChildCount',Node.Count,0);
|
||||
for i:=0 to Node.Count-1 do
|
||||
|
||||
@ -275,7 +275,8 @@ type
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
Merge: boolean);
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
SaveData, SaveSession: boolean);
|
||||
SaveData, SaveSession: boolean;
|
||||
UsePathDelim: TPathDelimSwitch);
|
||||
procedure UpdateUsageCount(Min, IfBelowThis, IncIfBelow: extended);
|
||||
procedure UpdateUsageCount(TheUsage: TUnitUsage; const Factor: extended);
|
||||
procedure UpdateSourceDirectoryReference;
|
||||
@ -375,7 +376,8 @@ type
|
||||
procedure Assign(Src: TCompilationToolOptions); override;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
DoSwitchPathDelims: boolean); override;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); override;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
UsePathDelim: TPathDelimSwitch); override;
|
||||
end;
|
||||
|
||||
{ TProjectCompilerOptions }
|
||||
@ -588,7 +590,7 @@ type
|
||||
FOnGetTestDirectory: TOnProjectGetTestDirectory;
|
||||
FOnLoadProjectInfo: TOnLoadProjectInfo;
|
||||
FOnSaveProjectInfo: TOnSaveProjectInfo;
|
||||
fPathDelimChanged: boolean;
|
||||
fPathDelimChanged: boolean; // PathDelim in system and current config differ (see StorePathDelim and SessionStorePathDelim)
|
||||
FPOOutputDirectory: string;
|
||||
fProjectDirectory: string;
|
||||
fProjectDirectoryReferenced: string;
|
||||
@ -596,6 +598,7 @@ type
|
||||
FPublishOptions: TPublishProjectOptions;
|
||||
FRevertLockCount: integer;
|
||||
FRunParameterOptions: TRunParamsOptions;
|
||||
FSessionStorePathDelim: TPathDelimSwitch;
|
||||
FSourceDirectories: TFileReferenceList;
|
||||
FStateFileDate: longint;
|
||||
FStateFlags: TLazProjectStateFlags;
|
||||
@ -868,6 +871,7 @@ type
|
||||
property SourceDirectories: TFileReferenceList read FSourceDirectories;
|
||||
property StateFileDate: longint read FStateFileDate write FStateFileDate;
|
||||
property StateFlags: TLazProjectStateFlags read FStateFlags write FStateFlags;
|
||||
property SessionStorePathDelim: TPathDelimSwitch read FSessionStorePathDelim write FSessionStorePathDelim;
|
||||
property StorePathDelim: TPathDelimSwitch read FStorePathDelim write FStorePathDelim;
|
||||
property TargetFileExt: String read FTargetFileExt write FTargetFileExt;
|
||||
property TargetFilename: string
|
||||
@ -1164,14 +1168,14 @@ end;
|
||||
TUnitInfo SaveToXMLConfig
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TUnitInfo.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
SaveData, SaveSession: boolean);
|
||||
SaveData, SaveSession: boolean; UsePathDelim: TPathDelimSwitch);
|
||||
var AFilename:string;
|
||||
begin
|
||||
// global data
|
||||
AFilename:=Filename;
|
||||
if Assigned(fOnLoadSaveFilename) then
|
||||
fOnLoadSaveFilename(AFilename,false);
|
||||
XMLConfig.SetValue(Path+'Filename/Value',AFilename);
|
||||
XMLConfig.SetValue(Path+'Filename/Value',SwitchPathDelims(AFilename,UsePathDelim));
|
||||
|
||||
// context data (project/session)
|
||||
if (IsPartOfProject and SaveData)
|
||||
@ -1901,6 +1905,8 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TProject.WriteProject(ProjectWriteFlags: TProjectWriteFlags;
|
||||
const OverrideProjectInfoFile: string): TModalResult;
|
||||
var
|
||||
UsePathDelim: TPathDelimSwitch;
|
||||
|
||||
procedure SaveFlags(XMLConfig: TXMLConfig; const Path: string);
|
||||
var f: TProjectFlag;
|
||||
@ -1960,7 +1966,7 @@ function TProject.WriteProject(ProjectWriteFlags: TProjectWriteFlags;
|
||||
if UnitMustBeSaved(i,SaveData,SaveSession) then begin
|
||||
Units[i].SaveToXMLConfig(
|
||||
xmlconfig,Path+'Units/Unit'+IntToStr(SaveUnitCount)+'/',
|
||||
SaveData,SaveSession);
|
||||
SaveData,SaveSession,UsePathDelim);
|
||||
inc(SaveUnitCount);
|
||||
end;
|
||||
end;
|
||||
@ -1990,10 +1996,9 @@ var
|
||||
CurSessionFilename: String;
|
||||
CurFlags: TProjectWriteFlags;
|
||||
SessionSaveResult: TModalResult;
|
||||
UsePathDelim: TPathDelimSwitch;
|
||||
begin
|
||||
Result := mrCancel;
|
||||
UsePathDelim:=pdsSystem;
|
||||
UsePathDelim:=pdsNone;
|
||||
|
||||
if OverrideProjectInfoFile<>'' then
|
||||
CfgFilename := OverrideProjectInfoFile
|
||||
@ -2043,7 +2048,7 @@ begin
|
||||
|
||||
try
|
||||
Path:='ProjectOptions/';
|
||||
xmlconfig.SetValue(Path+'PathDelim/Value',PathDelim);
|
||||
xmlconfig.SetValue(Path+'PathDelim/Value',PathDelimSwitchToDelim[UsePathDelim]);
|
||||
xmlconfig.SetValue(Path+'Version/Value',ProjectInfoFileVersion);
|
||||
SaveFlags(XMLConfig,Path);
|
||||
xmlconfig.SetDeleteValue(Path+'General/SessionStorage/Value',
|
||||
@ -2058,12 +2063,16 @@ begin
|
||||
|
||||
// lazdoc
|
||||
xmlconfig.SetDeleteValue(Path+'LazDoc/Paths',
|
||||
CreateRelativeSearchPath(LazDocPaths,ProjectDirectory), '');
|
||||
SwitchPathDelims(CreateRelativeSearchPath(LazDocPaths,ProjectDirectory),
|
||||
UsePathDelim),
|
||||
'');
|
||||
|
||||
// i18n
|
||||
xmlconfig.SetDeleteValue(Path+'i18n/EnableI18N/Value', EnableI18N, false);
|
||||
xmlconfig.SetDeleteValue(Path+'i18n/OutDir/Value',
|
||||
CreateRelativePath(POOutputDirectory,ProjectDirectory) , '');
|
||||
SwitchPathDelims(CreateRelativePath(POOutputDirectory,ProjectDirectory),
|
||||
UsePathDelim) ,
|
||||
'');
|
||||
|
||||
// Resources
|
||||
Resources.WriteToProjectFile(xmlconfig, Path);
|
||||
@ -2075,10 +2084,10 @@ begin
|
||||
CompilerOptions.SaveToXMLConfig(XMLConfig,'CompilerOptions/');
|
||||
|
||||
// save the Publish Options
|
||||
PublishOptions.SaveToXMLConfig(xmlconfig,Path+'PublishOptions/');
|
||||
PublishOptions.SaveToXMLConfig(xmlconfig,Path+'PublishOptions/',UsePathDelim);
|
||||
|
||||
// save the Run Parameter Options
|
||||
RunParameterOptions.Save(xmlconfig,Path);
|
||||
RunParameterOptions.Save(xmlconfig,Path,UsePathDelim);
|
||||
|
||||
// save dependencies
|
||||
SavePkgDependencyList(XMLConfig,Path+'RequiredPackages/',
|
||||
@ -2151,7 +2160,8 @@ begin
|
||||
|
||||
try
|
||||
Path:='ProjectSession/';
|
||||
xmlconfig.SetValue(Path+'PathDelim/Value',PathDelim);
|
||||
UsePathDelim:=pdsNone;
|
||||
xmlconfig.SetValue(Path+'PathDelim/Value',PathDelimSwitchToDelim[UsePathDelim]);
|
||||
xmlconfig.SetValue(Path+'Version/Value',ProjectInfoFileVersion);
|
||||
|
||||
// save all units
|
||||
@ -2508,10 +2518,10 @@ begin
|
||||
xmlconfig := TXMLConfig.Create(ProjectSessionFile);
|
||||
|
||||
Path:='ProjectSession/';
|
||||
fPathDelimChanged:=
|
||||
XMLConfig.GetValue(Path+'PathDelim/Value', PathDelim)<>PathDelim;
|
||||
SessionStorePathDelim:=CheckPathDelim(
|
||||
XMLConfig.GetValue(Path+'PathDelim/Value', PathDelim),fPathDelimChanged);
|
||||
|
||||
FileVersion:= XMLConfig.GetValue(Path+'Version/Value',0);
|
||||
FileVersion:=XMLConfig.GetValue(Path+'Version/Value',0);
|
||||
|
||||
// load session info
|
||||
LoadSessionInfo(XMLConfig,Path,true);
|
||||
@ -2527,20 +2537,14 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
fPathDelimChanged:=false;
|
||||
try
|
||||
Path:='ProjectOptions/';
|
||||
fPathDelimChanged:=
|
||||
XMLConfig.GetValue(Path+'PathDelim/Value', PathDelim)<>PathDelim;
|
||||
finally
|
||||
fPathDelimChanged:=false;
|
||||
try
|
||||
xmlconfig.Free;
|
||||
except
|
||||
end;
|
||||
xmlconfig:=nil;
|
||||
xmlconfig.Free;
|
||||
except
|
||||
end;
|
||||
xmlconfig:=nil;
|
||||
end else begin
|
||||
// there is no .ps file -> create some defaults
|
||||
// there is no .lps file -> create some defaults
|
||||
LoadDefaultSession;
|
||||
end;
|
||||
end;
|
||||
@ -3371,6 +3375,10 @@ begin
|
||||
end;
|
||||
|
||||
procedure TProject.OnLoadSaveFilename(var AFilename: string; Load:boolean);
|
||||
{ This function is used after reading a filename from the config
|
||||
and before writing a filename to a config.
|
||||
The config can be the lpi or the session.
|
||||
}
|
||||
var
|
||||
ProjectPath: string;
|
||||
FileWasAbsolute: Boolean;
|
||||
@ -3390,10 +3398,10 @@ var
|
||||
begin
|
||||
if AFileName='' then exit;
|
||||
//debugln('TProject.OnLoadSaveFilename A "',AFilename,'"');
|
||||
if not fPathDelimChanged then begin
|
||||
if (not fPathDelimChanged) or (not Load) then begin
|
||||
FileWasAbsolute:=FilenameIsAbsolute(AFileName);
|
||||
end else begin
|
||||
{$IFdef MSWindows}
|
||||
{$IFDEF MSWindows}
|
||||
// PathDelim changed from '/' to '\'
|
||||
FileWasAbsolute:=FilenameIsUnixAbsolute(AFileName);
|
||||
{$ELSE}
|
||||
@ -4620,9 +4628,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TProjectCompilationToolOptions.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
const Path: string; UsePathDelim: TPathDelimSwitch);
|
||||
begin
|
||||
inherited SaveToXMLConfig(XMLConfig, Path);
|
||||
inherited SaveToXMLConfig(XMLConfig, Path, UsePathDelim);
|
||||
SaveXMLCompileReasons(XMLConfig, Path+'CompileReasons/', CompileReasons,
|
||||
DefaultCompileReasons);
|
||||
end;
|
||||
|
||||
@ -38,7 +38,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Laz_XMLCfg,
|
||||
Forms, SynRegExpr, FileUtil, LCLProc,
|
||||
Forms, SynRegExpr, FileUtil, LCLProc, IDEProcs,
|
||||
ProjectIntf, PublishModule;
|
||||
|
||||
type
|
||||
@ -286,7 +286,8 @@ type
|
||||
procedure LoadDefaults; override;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const APath: string;
|
||||
AdjustPathDelims: boolean); override;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const APath: string); override;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const APath: string;
|
||||
UsePathDelim: TPathDelimSwitch); override;
|
||||
function WriteFlags: TProjectWriteFlags;
|
||||
public
|
||||
// project info
|
||||
@ -833,9 +834,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPublishProjectOptions.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
const APath: string);
|
||||
const APath: string; UsePathDelim: TPathDelimSwitch);
|
||||
begin
|
||||
inherited SaveToXMLConfig(XMLConfig,APath);
|
||||
inherited SaveToXMLConfig(XMLConfig,APath,UsePathDelim);
|
||||
XMLConfig.SetDeleteValue(APath+'SaveClosedEditorFilesInfo/Value',
|
||||
SaveClosedEditorFilesInfo,false);
|
||||
XMLConfig.SetDeleteValue(APath+'SaveEditorInfoOfNonProjectFiles/Value',
|
||||
|
||||
@ -80,7 +80,8 @@ type
|
||||
procedure LoadDefaults; virtual;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const APath: string;
|
||||
AdjustPathDelims: boolean); virtual;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const APath: string); virtual;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const APath: string;
|
||||
UsePathDelim: TPathDelimSwitch); virtual;
|
||||
function FileCanBePublished(const AFilename: string): boolean; virtual;
|
||||
procedure LockModified;
|
||||
procedure UnlockModified;
|
||||
@ -314,12 +315,19 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPublishModuleOptions.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
const APath: string);
|
||||
const APath: string; UsePathDelim: TPathDelimSwitch);
|
||||
|
||||
function f(const AFilename: string): string;
|
||||
begin
|
||||
Result:=SwitchPathDelims(AFilename,UsePathDelim);
|
||||
end;
|
||||
|
||||
begin
|
||||
XMLConfig.SetValue(APath+'Version/Value',PublishModulOptsVersion);
|
||||
XMLConfig.SetDeleteValue(APath+'DestinationDirectory/Value',
|
||||
DestinationDirectory,GetDefaultDestinationDir);
|
||||
XMLConfig.SetDeleteValue(APath+'CommandAfter/Value',CommandAfter,'');
|
||||
f(DestinationDirectory),
|
||||
f(GetDefaultDestinationDir));
|
||||
XMLConfig.SetDeleteValue(APath+'CommandAfter/Value',f(CommandAfter),'');
|
||||
XMLConfig.SetDeleteValue(APath+'IgnoreBinaries/Value',IgnoreBinaries,true);
|
||||
XMLConfig.SetDeleteValue(APath+'UseIncludeFileFilter/Value',
|
||||
UseIncludeFileFilter,true);
|
||||
|
||||
@ -64,6 +64,9 @@ type
|
||||
{
|
||||
the storage object for run parameters
|
||||
}
|
||||
|
||||
{ TRunParamsOptions }
|
||||
|
||||
TRunParamsOptions = class
|
||||
private
|
||||
// local options
|
||||
@ -84,7 +87,8 @@ type
|
||||
procedure Clear;
|
||||
function Load(XMLConfig: TXMLConfig; const Path: string;
|
||||
AdjustPathDelims: boolean): TModalResult;
|
||||
function Save(XMLConfig: TXMLConfig; const Path: string): TModalResult;
|
||||
function Save(XMLConfig: TXMLConfig; const Path: string;
|
||||
UsePathDelim: TPathDelimSwitch): TModalResult;
|
||||
procedure AssignEnvironmentTo(Strings: TStrings);
|
||||
|
||||
// local options
|
||||
@ -271,8 +275,13 @@ begin
|
||||
Result := mrOk;
|
||||
end;
|
||||
|
||||
function TRunParamsOptions.Save(XMLConfig: TXMLConfig;
|
||||
const Path: string): TModalResult;
|
||||
function TRunParamsOptions.Save(XMLConfig: TXMLConfig; const Path: string;
|
||||
UsePathDelim: TPathDelimSwitch): TModalResult;
|
||||
|
||||
function f(const AFilename: string): string;
|
||||
begin
|
||||
Result:=SwitchPathDelims(AFilename,UsePathDelim);
|
||||
end;
|
||||
|
||||
procedure SaveUserOverrides(const APath: string);
|
||||
var
|
||||
@ -295,15 +304,15 @@ begin
|
||||
|
||||
// local options
|
||||
XMLConfig.SetDeleteValue(Path + 'RunParams/local/HostApplicationFilename/Value',
|
||||
fHostApplicationFilename, '');
|
||||
f(fHostApplicationFilename), '');
|
||||
XMLConfig.SetDeleteValue(Path + 'RunParams/local/CommandLineParams/Value',
|
||||
fCmdLineParams, '');
|
||||
f(fCmdLineParams), '');
|
||||
XMLConfig.SetDeleteValue(Path + 'RunParams/local/LaunchingApplication/Use',
|
||||
fUseLaunchingApplication, False);
|
||||
XMLConfig.SetDeleteValue(Path + 'RunParams/local/LaunchingApplication/PathPlusParams',
|
||||
fLaunchingApplicationPathPlusParams, '');
|
||||
f(fLaunchingApplicationPathPlusParams), '');
|
||||
XMLConfig.SetDeleteValue(Path + 'RunParams/local/WorkingDirectory/Value',
|
||||
fWorkingDirectory, '');
|
||||
f(fWorkingDirectory), '');
|
||||
XMLConfig.SetDeleteValue(Path + 'RunParams/local/Display/Use',
|
||||
fUseDisplay, False);
|
||||
XMLConfig.SetDeleteValue(Path + 'RunParams/local/Display/Value',
|
||||
|
||||
@ -2724,9 +2724,9 @@ var
|
||||
end;
|
||||
|
||||
begin
|
||||
UsePathDelim:=pdsSystem;
|
||||
UsePathDelim:=pdsNone;
|
||||
XMLConfig.SetValue(Path+'Version',LazPkgXMLFileVersion);
|
||||
XMLConfig.SetDeleteValue(Path+'PathDelim/Value',PathDelim,'/');
|
||||
XMLConfig.SetDeleteValue(Path+'PathDelim/Value',PathDelimSwitchToDelim[UsePathDelim],'/');
|
||||
XMLConfig.SetDeleteValue(Path+'Name/Value',FName,'');
|
||||
XMLConfig.SetDeleteValue(Path+'AddToProjectUsesSection/Value',
|
||||
FAddToProjectUsesSection,true);
|
||||
@ -2751,8 +2751,8 @@ begin
|
||||
LazPackageTypeIdents[lptRunTime]);
|
||||
SavePkgDependencyList(XMLConfig,Path+'RequiredPkgs/',
|
||||
FFirstRequiredDependency,pdlRequires,UsePathDelim);
|
||||
FUsageOptions.SaveToXMLConfig(XMLConfig,Path+'UsageOptions/');
|
||||
fPublishOptions.SaveToXMLConfig(XMLConfig,Path+'PublishOptions/');
|
||||
FUsageOptions.SaveToXMLConfig(XMLConfig,Path+'UsageOptions/',UsePathDelim);
|
||||
fPublishOptions.SaveToXMLConfig(XMLConfig,Path+'PublishOptions/',UsePathDelim);
|
||||
SaveStringList(XMLConfig,FProvides,Path+'Provides/');
|
||||
Modified:=false;
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user