mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 15:28:14 +02:00
added automatic linux-windows file conversions
git-svn-id: trunk@4315 -
This commit is contained in:
parent
56011260fc
commit
3057f78850
@ -460,10 +460,14 @@ var
|
||||
ExpPath: String;
|
||||
l: integer;
|
||||
begin
|
||||
ExpFile:=CleanAndExpandFilename(Filename);
|
||||
ExpPath:=CleanAndExpandDirectory(Path);
|
||||
if Path='' then begin
|
||||
Result:=false;
|
||||
exit;
|
||||
end;
|
||||
ExpFile:=TrimFilename(Filename);
|
||||
ExpPath:=AppendPathDelim(TrimFilename(Path));
|
||||
l:=length(ExpPath);
|
||||
Result:=(length(ExpFile)>l) and (ExpFile[l+1]=PathDelim)
|
||||
Result:=(l>0) and (length(ExpFile)>l) and (ExpFile[l]=PathDelim)
|
||||
and (CompareFilenames(ExpPath,LeftStr(ExpFile,l))=0);
|
||||
end;
|
||||
|
||||
|
@ -78,14 +78,15 @@ type
|
||||
pcosLinkerOptions,// additional linker options
|
||||
pcosCustomOptions,// additional options
|
||||
pcosOutputDir, // the output directory
|
||||
pcosCompilerPath // the filename of the compiler
|
||||
pcosCompilerPath, // the filename of the compiler
|
||||
pcosDebugPath // additional debug search path
|
||||
);
|
||||
TParsedCompilerOptStrings = set of TParsedCompilerOptString;
|
||||
|
||||
|
||||
const
|
||||
ParsedCompilerSearchPaths = [pcosUnitPath,pcosIncludePath,pcosObjectPath,
|
||||
pcosLibraryPath,pcosSrcPath];
|
||||
pcosLibraryPath,pcosSrcPath,pcosDebugPath];
|
||||
ParsedCompilerFilenames = [pcosCompilerPath];
|
||||
ParsedCompilerDirectories = [pcosOutputDir];
|
||||
ParsedCompilerFiles =
|
||||
@ -136,7 +137,8 @@ type
|
||||
procedure Clear;
|
||||
function IsEqual(Params: TCompilationTool): boolean;
|
||||
procedure Assign(Src: TCompilationTool);
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
DoSwitchPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
end;
|
||||
|
||||
@ -292,6 +294,8 @@ type
|
||||
function GetParsedPath(Option: TParsedCompilerOptString;
|
||||
InheritedOption: TInheritedCompilerOption;
|
||||
RelativeToBaseDir: boolean): string;
|
||||
function ShortenPath(const SearchPath: string;
|
||||
MakeAlwaysRelative: boolean): string;
|
||||
function GetCustomOptions: string;
|
||||
public
|
||||
{ Properties }
|
||||
@ -431,7 +435,8 @@ type
|
||||
constructor Create(TheOwner: TObject);
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
AdjustPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
function GetOwnerName: string; virtual;
|
||||
public
|
||||
@ -996,9 +1001,13 @@ end;
|
||||
procedure TBaseCompilerOptions.SetIncludeFiles(const AValue: String);
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TBaseCompilerOptions.SetIncludeFiles(const AValue: String);
|
||||
var
|
||||
NewValue: String;
|
||||
begin
|
||||
if fIncludeFiles=AValue then exit;
|
||||
fIncludeFiles:=AValue;
|
||||
NewValue:=ShortenPath(AValue,false);
|
||||
if NewValue<>AValue then
|
||||
if fIncludeFiles=NewValue then exit;
|
||||
fIncludeFiles:=NewValue;
|
||||
ParsedOpts.SetUnparsedValue(pcosIncludePath,fIncludeFiles);
|
||||
end;
|
||||
|
||||
@ -1017,16 +1026,23 @@ begin
|
||||
end;
|
||||
|
||||
procedure TBaseCompilerOptions.SetSrcPath(const AValue: string);
|
||||
var
|
||||
NewValue: String;
|
||||
begin
|
||||
if FSrcPath=AValue then exit;
|
||||
FSrcPath:=AValue;
|
||||
NewValue:=ShortenPath(AValue,false);
|
||||
if FSrcPath=NewValue then exit;
|
||||
FSrcPath:=NewValue;
|
||||
ParsedOpts.SetUnparsedValue(pcosSrcPath,FSrcPath);
|
||||
end;
|
||||
|
||||
procedure TBaseCompilerOptions.SetDebugPath(const AValue: string);
|
||||
var
|
||||
NewValue: String;
|
||||
begin
|
||||
if fDebugPath=AValue then exit;
|
||||
fDebugPath:=AValue;
|
||||
NewValue:=ShortenPath(AValue,false);
|
||||
if fDebugPath=NewValue then exit;
|
||||
fDebugPath:=NewValue;
|
||||
ParsedOpts.SetUnparsedValue(pcosDebugPath,fDebugPath);
|
||||
end;
|
||||
|
||||
procedure TBaseCompilerOptions.SetBaseDirectory(const AValue: string);
|
||||
@ -1044,9 +1060,12 @@ begin
|
||||
end;
|
||||
|
||||
procedure TBaseCompilerOptions.SetLibraries(const AValue: String);
|
||||
var
|
||||
NewValue: String;
|
||||
begin
|
||||
if fLibraries=AValue then exit;
|
||||
fLibraries:=AValue;
|
||||
NewValue:=ShortenPath(AValue,false);
|
||||
if fLibraries=NewValue then exit;
|
||||
fLibraries:=NewValue;
|
||||
ParsedOpts.SetUnparsedValue(pcosLibraryPath,fLibraries);
|
||||
end;
|
||||
|
||||
@ -1058,9 +1077,12 @@ begin
|
||||
end;
|
||||
|
||||
procedure TBaseCompilerOptions.SetOtherUnitFiles(const AValue: String);
|
||||
var
|
||||
NewValue: String;
|
||||
begin
|
||||
if fOtherUnitFiles=AValue then exit;
|
||||
fOtherUnitFiles:=AValue;
|
||||
NewValue:=ShortenPath(AValue,false);
|
||||
if fOtherUnitFiles=NewValue then exit;
|
||||
fOtherUnitFiles:=NewValue;
|
||||
ParsedOpts.SetUnparsedValue(pcosUnitPath,fOtherUnitFiles);
|
||||
end;
|
||||
|
||||
@ -1072,9 +1094,12 @@ begin
|
||||
end;
|
||||
|
||||
procedure TBaseCompilerOptions.SetObjectPath(const AValue: string);
|
||||
var
|
||||
NewValue: String;
|
||||
begin
|
||||
if FObjectPath=AValue then exit;
|
||||
FObjectPath:=AValue;
|
||||
NewValue:=ShortenPath(AValue,false);
|
||||
if FObjectPath=NewValue then exit;
|
||||
FObjectPath:=NewValue;
|
||||
ParsedOpts.SetUnparsedValue(pcosObjectPath,FObjectPath);
|
||||
end;
|
||||
|
||||
@ -1084,6 +1109,13 @@ end;
|
||||
procedure TBaseCompilerOptions.LoadTheCompilerOptions(const Path: string);
|
||||
var
|
||||
p: String;
|
||||
PathDelimChanged: boolean;
|
||||
|
||||
function f(const Filename: string): string;
|
||||
begin
|
||||
Result:=SwitchPathDelims(Filename,PathDelimChanged);
|
||||
end;
|
||||
|
||||
begin
|
||||
{ Load the compiler options from the XML file }
|
||||
if Path='' then
|
||||
@ -1091,18 +1123,20 @@ begin
|
||||
else
|
||||
p:=Path;
|
||||
|
||||
PathDelimChanged:=XMLConfigFile.GetValue(p+'PathDelim/Value', '/')<>PathDelim;
|
||||
|
||||
{ Target }
|
||||
TargetFilename := XMLConfigFile.GetValue(p+'Filename/Value', '');
|
||||
|
||||
{ SearchPaths }
|
||||
p:='CompilerOptions/SearchPaths/';
|
||||
IncludeFiles := XMLConfigFile.GetValue(p+'IncludeFiles/Value', '');
|
||||
Libraries := XMLConfigFile.GetValue(p+'Libraries/Value', '');
|
||||
OtherUnitFiles := XMLConfigFile.GetValue(p+'OtherUnitFiles/Value', '');
|
||||
UnitOutputDirectory := XMLConfigFile.GetValue(p+'UnitOutputDirectory/Value', '');
|
||||
IncludeFiles := f(XMLConfigFile.GetValue(p+'IncludeFiles/Value', ''));
|
||||
Libraries := f(XMLConfigFile.GetValue(p+'Libraries/Value', ''));
|
||||
OtherUnitFiles := f(XMLConfigFile.GetValue(p+'OtherUnitFiles/Value', ''));
|
||||
UnitOutputDirectory := f(XMLConfigFile.GetValue(p+'UnitOutputDirectory/Value', ''));
|
||||
LCLWidgetType := XMLConfigFile.GetValue(p+'LCLWidgetType/Value', 'gtk');
|
||||
ObjectPath := XMLConfigFile.GetValue(p+'ObjectPath/Value', '');
|
||||
SrcPath := XMLConfigFile.GetValue(p+'SrcPath/Value', '');
|
||||
ObjectPath := f(XMLConfigFile.GetValue(p+'ObjectPath/Value', ''));
|
||||
SrcPath := f(XMLConfigFile.GetValue(p+'SrcPath/Value', ''));
|
||||
|
||||
{ Parsing }
|
||||
p:='CompilerOptions/Parsing/';
|
||||
@ -1147,7 +1181,7 @@ begin
|
||||
StripSymbols := XMLConfigFile.GetValue(p+'Debugging/StripSymbols/Value', false);
|
||||
LinkStyle := XMLConfigFile.GetValue(p+'LinkStyle/Value', 1);
|
||||
PassLinkerOptions := XMLConfigFile.GetValue(p+'Options/PassLinkerOptions/Value', false);
|
||||
LinkerOptions := XMLConfigFile.GetValue(p+'Options/LinkerOptions/Value', '');
|
||||
LinkerOptions := f(XMLConfigFile.GetValue(p+'Options/LinkerOptions/Value', ''));
|
||||
|
||||
{ Messages }
|
||||
p:='CompilerOptions/Other/';
|
||||
@ -1174,14 +1208,14 @@ begin
|
||||
p:='CompilerOptions/Other/';
|
||||
DontUseConfigFile := XMLConfigFile.GetValue(p+'ConfigFile/DontUseConfigFile/Value', false);
|
||||
AdditionalConfigFile := XMLConfigFile.GetValue(p+'ConfigFile/AdditionalConfigFile/Value', false);
|
||||
ConfigFilePath := XMLConfigFile.GetValue(p+'ConfigFile/ConfigFilePath/Value', './fpc.cfg');
|
||||
ConfigFilePath := f(XMLConfigFile.GetValue(p+'ConfigFile/ConfigFilePath/Value', './fpc.cfg'));
|
||||
CustomOptions := XMLConfigFile.GetValue(p+'CustomOptions/Value', '');
|
||||
|
||||
{ Compilation }
|
||||
CompilerPath := XMLConfigFile.GetValue(p+'CompilerPath/Value','$(CompPath)');
|
||||
CompilerPath := f(XMLConfigFile.GetValue(p+'CompilerPath/Value','$(CompPath)'));
|
||||
fSkipCompiler := XMLConfigFile.GetValue(p+'SkipCompiler/Value',false);
|
||||
ExecuteBefore.LoadFromXMLConfig(XMLConfig,p+'ExecuteBefore/');
|
||||
ExecuteAfter.LoadFromXMLConfig(XMLConfig,p+'ExecuteAfter/');
|
||||
ExecuteBefore.LoadFromXMLConfig(XMLConfig,p+'ExecuteBefore/',PathDelimChanged);
|
||||
ExecuteAfter.LoadFromXMLConfig(XMLConfig,p+'ExecuteAfter/',PathDelimChanged);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -1224,6 +1258,8 @@ begin
|
||||
p:='CompilerOptions/Target/'
|
||||
else
|
||||
p:=Path;
|
||||
|
||||
XMLConfigFile.SetDeleteValue(p+'PathDelim/Value', PathDelim, '/');
|
||||
|
||||
{ Target }
|
||||
XMLConfigFile.SetDeleteValue(p+'Filename/Value', TargetFilename,'');
|
||||
@ -1473,6 +1509,16 @@ begin
|
||||
Result:=SpecialCharsToSpaces(Result);
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.ShortenPath(const SearchPath: string;
|
||||
MakeAlwaysRelative: boolean): string;
|
||||
begin
|
||||
Result:=TrimSearchPath(SearchPath,'');
|
||||
if MakeAlwaysRelative then
|
||||
Result:=CreateRelativeSearchPath(Result,BaseDirectory)
|
||||
else
|
||||
Result:=ShortenSearchPath(Result,BaseDirectory,BaseDirectory);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TBaseCompilerOptions MakeOptionsString
|
||||
------------------------------------------------------------------------------}
|
||||
@ -2542,6 +2588,7 @@ procedure TfrmCompilerOptions.FileBrowseBtnClick(Sender: TObject);
|
||||
var
|
||||
OpenDialog: TOpenDialog;
|
||||
DefaultFilename: String;
|
||||
NewFilename: String;
|
||||
begin
|
||||
OpenDialog:=TOpenDialog.Create(Self);
|
||||
try
|
||||
@ -2559,6 +2606,9 @@ begin
|
||||
if DefaultFilename<>'' then
|
||||
OpenDialog.InitialDir:=ExtractFilePath(DefaultFilename);
|
||||
if OpenDialog.Execute then begin
|
||||
NewFilename:=TrimFilename(OpenDialog.Filename);
|
||||
if CompilerOpts<>nil then
|
||||
NewFilename:=CompilerOpts.ShortenPath(NewFilename,false);
|
||||
if Sender=btnCompiler then begin
|
||||
edtCompiler.Text:=OpenDialog.Filename;
|
||||
end else if Sender=btnUnitOutputDir then begin
|
||||
@ -4541,6 +4591,8 @@ begin
|
||||
AButton:=TPathEditorButton(Sender);
|
||||
if AButton.CurrentPathEditor.ModalResult<>mrOk then exit;
|
||||
NewPath:=AButton.CurrentPathEditor.Path;
|
||||
if CompilerOpts<>nil then
|
||||
NewPath:=CompilerOpts.ShortenPath(NewPath,false);
|
||||
if AButton=OtherUnitsPathEditBtn then begin
|
||||
edtOtherUnits.Text:=NewPath;
|
||||
end else
|
||||
@ -4675,15 +4727,21 @@ begin
|
||||
end;
|
||||
|
||||
procedure TAdditionalCompilerOptions.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
const Path: string; AdjustPathDelims: boolean);
|
||||
|
||||
function f(const Filename: string): string;
|
||||
begin
|
||||
Result:=SwitchPathDelims(Filename,AdjustPathDelims);
|
||||
end;
|
||||
|
||||
begin
|
||||
Clear;
|
||||
CustomOptions:=XMLConfig.GetValue(Path+'CustomOptions/Value','');
|
||||
IncludePath:=XMLConfig.GetValue(Path+'IncludePath/Value','');
|
||||
LibraryPath:=XMLConfig.GetValue(Path+'LibraryPath/Value','');
|
||||
LinkerOptions:=XMLConfig.GetValue(Path+'LinkerOptions/Value','');
|
||||
ObjectPath:=XMLConfig.GetValue(Path+'ObjectPath/Value','');
|
||||
UnitPath:=XMLConfig.GetValue(Path+'UnitPath/Value','');
|
||||
CustomOptions:=f(XMLConfig.GetValue(Path+'CustomOptions/Value',''));
|
||||
IncludePath:=f(XMLConfig.GetValue(Path+'IncludePath/Value',''));
|
||||
LibraryPath:=f(XMLConfig.GetValue(Path+'LibraryPath/Value',''));
|
||||
LinkerOptions:=f(XMLConfig.GetValue(Path+'LinkerOptions/Value',''));
|
||||
ObjectPath:=f(XMLConfig.GetValue(Path+'ObjectPath/Value',''));
|
||||
UnitPath:=f(XMLConfig.GetValue(Path+'UnitPath/Value',''));
|
||||
end;
|
||||
|
||||
procedure TAdditionalCompilerOptions.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||
@ -4830,9 +4888,10 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCompilationTool.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
const Path: string; DoSwitchPathDelims: boolean);
|
||||
begin
|
||||
Command:=XMLConfig.GetValue(Path+'Command/Value','');
|
||||
Command:=SwitchPathDelims(XMLConfig.GetValue(Path+'Command/Value',''),
|
||||
DoSwitchPathDelims);
|
||||
ScanForFPCMessages:=XMLConfig.GetValue(Path+'ScanForFPCMsgs/Value',false);
|
||||
ScanForMakeMessages:=XMLConfig.GetValue(Path+'ScanForMakeMsgs/Value',false);
|
||||
end;
|
||||
|
@ -300,6 +300,7 @@ type
|
||||
fOnFileBackup: TOnFileBackup;
|
||||
FOnLoadProjectInfo: TOnLoadProjectInfo;
|
||||
FOnSaveProjectInfo: TOnSaveProjectInfo;
|
||||
fPathDelimChanged: boolean;
|
||||
fProjectDirectory: string;
|
||||
fProjectInfoFile: String; // the lpi filename
|
||||
fProjectType: TProjectType;
|
||||
@ -1464,6 +1465,9 @@ begin
|
||||
end;
|
||||
|
||||
try
|
||||
fPathDelimChanged:=
|
||||
XMLConfig.GetValue('ProjectOptions/PathDelim/Value', '/')<>PathDelim;
|
||||
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject C reading values');{$ENDIF}
|
||||
FileVersion:= XMLConfig.GetValue('ProjectOptions/Version/Value',0);
|
||||
ProjectType := ProjectTypeNameToType(xmlconfig.GetValue(
|
||||
@ -1498,10 +1502,11 @@ begin
|
||||
if FileVersion<2 then CompilerOptions.SrcPath:=OldSrcPath;
|
||||
|
||||
// load the Publish Options
|
||||
PublishOptions.LoadFromXMLConfig(xmlconfig,'ProjectOptions/PublishOptions/');
|
||||
PublishOptions.LoadFromXMLConfig(xmlconfig,
|
||||
'ProjectOptions/PublishOptions/',fPathDelimChanged);
|
||||
|
||||
// load the Run Parameter Options
|
||||
RunParameterOptions.Load(xmlconfig,'ProjectOptions/');
|
||||
RunParameterOptions.Load(xmlconfig,'ProjectOptions/',fPathDelimChanged);
|
||||
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject update ct boss');{$ENDIF}
|
||||
CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'ProjPath']:=
|
||||
@ -1516,6 +1521,7 @@ begin
|
||||
|
||||
finally
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject freeing xml');{$ENDIF}
|
||||
fPathDelimChanged:=false;
|
||||
xmlconfig.Free;
|
||||
xmlconfig:=nil;
|
||||
end;
|
||||
@ -2159,7 +2165,8 @@ begin
|
||||
if AFileName='' then exit;
|
||||
ProjectPath:=ProjectDirectory;
|
||||
if ProjectPath='' then ProjectPath:=GetCurrentDir;
|
||||
DoDirSeparators(AFilename);
|
||||
if fPathDelimChanged then
|
||||
DoDirSeparators(AFilename);
|
||||
AFilename:=TrimFilename(AFilename);
|
||||
if Load then begin
|
||||
// make filename absolute
|
||||
@ -2654,6 +2661,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.130 2003/06/25 17:22:47 mattias
|
||||
added automatic linux-windows file conversions
|
||||
|
||||
Revision 1.129 2003/06/19 09:26:58 mattias
|
||||
fixed changing unitname during update
|
||||
|
||||
|
@ -215,7 +215,8 @@ type
|
||||
procedure SetSaveEditorInfoOfNonProjectFiles(const AValue: boolean);
|
||||
public
|
||||
procedure LoadDefaults; override;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const APath: string); override;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const APath: string;
|
||||
AdjustPathDelims: boolean); override;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const APath: string); override;
|
||||
function WriteFlags: TProjectWriteFlags;
|
||||
public
|
||||
@ -725,11 +726,11 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPublishProjectOptions.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
const APath: string);
|
||||
const APath: string; AdjustPathDelims: boolean);
|
||||
//var
|
||||
// XMLVersion: integer;
|
||||
begin
|
||||
inherited LoadFromXMLConfig(XMLConfig,APath);
|
||||
inherited LoadFromXMLConfig(XMLConfig,APath,AdjustPathDelims);
|
||||
//XMLVersion:=XMLConfig.GetValue(APath+'Version/Value',0);
|
||||
FSaveClosedEditorFilesInfo:=XMLConfig.GetValue(
|
||||
APath+'SaveClosedEditorFilesInfo/Value',SaveClosedEditorFilesInfo);
|
||||
|
@ -77,7 +77,8 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure Clear; virtual;
|
||||
procedure LoadDefaults; virtual;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const APath: string); virtual;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const APath: string;
|
||||
AdjustPathDelims: boolean); virtual;
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const APath: string); virtual;
|
||||
function FileCanBePublished(const AFilename: string): boolean; virtual;
|
||||
procedure LockModified;
|
||||
@ -279,14 +280,20 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPublishModuleOptions.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
const APath: string);
|
||||
const APath: string; AdjustPathDelims: boolean);
|
||||
|
||||
function f(const Filename: string): string;
|
||||
begin
|
||||
Result:=SwitchPathDelims(Filename,AdjustPathDelims);
|
||||
end;
|
||||
|
||||
var
|
||||
XMLVersion: integer;
|
||||
begin
|
||||
XMLVersion:=XMLConfig.GetValue(APath+'Version/Value',0);
|
||||
FDestinationDirectory:=XMLConfig.GetValue(APath+'DestinationDirectory/Value',
|
||||
GetDefaultDestinationDir);
|
||||
FCommandAfter:=XMLConfig.GetValue(APath+'CommandAfter/Value','');
|
||||
FDestinationDirectory:=f(XMLConfig.GetValue(APath+'DestinationDirectory/Value',
|
||||
GetDefaultDestinationDir));
|
||||
FCommandAfter:=f(XMLConfig.GetValue(APath+'CommandAfter/Value',''));
|
||||
IgnoreBinaries:=XMLConfig.GetValue(APath+'IgnoreBinaries/Value',true);
|
||||
UseIncludeFileFilter:=XMLConfig.GetValue(APath+'UseIncludeFileFilter/Value',
|
||||
true);
|
||||
|
@ -79,7 +79,8 @@ type
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
function Load(XMLConfig: TXMLConfig; const Path: string): TModalResult;
|
||||
function Load(XMLConfig: TXMLConfig; const Path: string;
|
||||
AdjustPathDelims: boolean): TModalResult;
|
||||
function Save(XMLConfig: TXMLConfig; const Path: string): TModalResult;
|
||||
procedure AssignEnvironmentTo(Strings: TStrings);
|
||||
|
||||
@ -219,7 +220,13 @@ begin
|
||||
end;
|
||||
|
||||
function TRunParamsOptions.Load(XMLConfig: TXMLConfig;
|
||||
const Path: string): TModalResult;
|
||||
const Path: string; AdjustPathDelims: boolean): TModalResult;
|
||||
|
||||
|
||||
function f(const Filename: string): string;
|
||||
begin
|
||||
Result:=SwitchPathDelims(Filename,AdjustPathDelims);
|
||||
end;
|
||||
|
||||
procedure LoadUserOverrides(const APath: string);
|
||||
var i, Cnt: integer;
|
||||
@ -235,23 +242,23 @@ function TRunParamsOptions.Load(XMLConfig: TXMLConfig;
|
||||
|
||||
begin
|
||||
// local options
|
||||
fHostApplicationFilename:=XMLConfig.GetValue(
|
||||
fHostApplicationFilename:=f(XMLConfig.GetValue(
|
||||
Path+'RunParams/local/HostApplicationFilename/Value',
|
||||
fHostApplicationFilename);
|
||||
fCmdLineParams:=XMLConfig.GetValue(
|
||||
fHostApplicationFilename));
|
||||
fCmdLineParams:=f(XMLConfig.GetValue(
|
||||
Path+'RunParams/local/CommandLineParams/Value',
|
||||
fCmdLineParams);
|
||||
fCmdLineParams));
|
||||
fUseLaunchingApplication:=XMLConfig.GetValue(
|
||||
Path+'RunParams/local/LaunchingApplication/Use',
|
||||
fUseLaunchingApplication);
|
||||
fLaunchingApplicationPathPlusParams:=XMLConfig.GetValue(
|
||||
fLaunchingApplicationPathPlusParams:=f(XMLConfig.GetValue(
|
||||
Path+'RunParams/local/LaunchingApplication/PathPlusParams',
|
||||
fLaunchingApplicationPathPlusParams);
|
||||
fLaunchingApplicationPathPlusParams));
|
||||
if (fLaunchingApplicationPathPlusParams='') then
|
||||
fLaunchingApplicationPathPlusParams:=DefaultLauncherApplication;
|
||||
fWorkingDirectory:=XMLConfig.GetValue(
|
||||
fWorkingDirectory:=f(XMLConfig.GetValue(
|
||||
Path+'RunParams/local/WorkingDirectory/Value',
|
||||
fWorkingDirectory);
|
||||
fWorkingDirectory));
|
||||
fUseDisplay:=XMLConfig.GetValue(
|
||||
Path+'RunParams/local/Display/Use',
|
||||
fUseDisplay);
|
||||
|
@ -155,7 +155,7 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
FileVersion: integer);
|
||||
FileVersion: integer; AdjustPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
procedure ConsistencyCheck;
|
||||
function IsVirtual: boolean;
|
||||
@ -1134,13 +1134,14 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPkgFile.LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
FileVersion: integer);
|
||||
FileVersion: integer; AdjustPathDelims: boolean);
|
||||
var
|
||||
AFilename: String;
|
||||
begin
|
||||
if FileVersion=1 then ;
|
||||
Clear;
|
||||
AFilename:=XMLConfig.GetValue(Path+'Filename/Value','');
|
||||
AFilename:=SwitchPathDelims(XMLConfig.GetValue(Path+'Filename/Value',''),
|
||||
AdjustPathDelims);
|
||||
FPackage.LongenFilename(AFilename);
|
||||
Filename:=AFilename;
|
||||
FileType:=PkgFileTypeIdentToType(XMLConfig.GetValue(Path+'Type/Value',''));
|
||||
@ -1952,6 +1953,7 @@ procedure TLazPackage.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
var
|
||||
FileVersion: integer;
|
||||
OldFilename: String;
|
||||
PathDelimChanged: boolean;
|
||||
|
||||
procedure LoadFiles(const ThePath: string; List: TList);
|
||||
var
|
||||
@ -1963,7 +1965,7 @@ var
|
||||
for i:=0 to NewCount-1 do begin
|
||||
PkgFile:=TPkgFile.Create(Self);
|
||||
PkgFile.LoadFromXMLConfig(XMLConfig,ThePath+'Item'+IntToStr(i+1)+'/',
|
||||
FileVersion);
|
||||
FileVersion,PathDelimChanged);
|
||||
List.Add(PkgFile);
|
||||
end;
|
||||
end;
|
||||
@ -1985,6 +1987,7 @@ begin
|
||||
Clear;
|
||||
Filename:=OldFilename;
|
||||
LockModified;
|
||||
PathDelimChanged:=XMLConfig.GetValue(Path+'PathDelim/Value','/')<>'/';
|
||||
Name:=XMLConfig.GetValue(Path+'Name/Value','');
|
||||
FAuthor:=XMLConfig.GetValue(Path+'Author/Value','');
|
||||
FAutoUpdate:=NameToAutoUpdatePolicy(
|
||||
@ -1995,15 +1998,19 @@ begin
|
||||
FVersion.LoadFromXMLConfig(XMLConfig,Path+'Version/',FileVersion);
|
||||
LoadFiles(Path+'Files/',FFiles);
|
||||
LoadFlags(Path);
|
||||
FIconFile:=XMLConfig.GetValue(Path+'IconFile/Value','');
|
||||
FName:=XMLConfig.GetValue(Path+'Name/Value','');
|
||||
OutputStateFile:=XMLConfig.GetValue(Path+'OutputStateFile/Value','');
|
||||
FIconFile:=SwitchPathDelims(XMLConfig.GetValue(Path+'IconFile/Value',''),
|
||||
PathDelimChanged);
|
||||
OutputStateFile:=SwitchPathDelims(
|
||||
XMLConfig.GetValue(Path+'OutputStateFile/Value',''),
|
||||
PathDelimChanged);
|
||||
FPackageType:=LazPackageTypeIdentToType(XMLConfig.GetValue(Path+'Type/Value',
|
||||
LazPackageTypeIdents[lptRunTime]));
|
||||
LoadPkgDependencyList(XMLConfig,Path+'RequiredPkgs/',
|
||||
FFirstRequiredDependency,pdlRequires,Self,false);
|
||||
FUsageOptions.LoadFromXMLConfig(XMLConfig,Path+'UsageOptions/');
|
||||
fPublishOptions.LoadFromXMLConfig(XMLConfig,Path+'PublishOptions/');
|
||||
FUsageOptions.LoadFromXMLConfig(XMLConfig,Path+'UsageOptions/',
|
||||
PathDelimChanged);
|
||||
fPublishOptions.LoadFromXMLConfig(XMLConfig,Path+'PublishOptions/',
|
||||
PathDelimChanged);
|
||||
EndUpdate;
|
||||
Modified:=false;
|
||||
UnlockModified;
|
||||
@ -2032,6 +2039,7 @@ procedure TLazPackage.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string
|
||||
end;
|
||||
|
||||
begin
|
||||
XMLConfig.SetDeleteValue(Path+'PathDelim/Value',PathDelim,'/');
|
||||
XMLConfig.SetDeleteValue(Path+'Name/Value',FName,'');
|
||||
XMLConfig.SetDeleteValue(Path+'Author/Value',FAuthor,'');
|
||||
XMLConfig.SetDeleteValue(Path+'AutoUpdate/Value',AutoUpdateNames[FAutoUpdate],
|
||||
|
Loading…
Reference in New Issue
Block a user