mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 13:39:18 +02:00
resolving lazarus directory even if started with search path
git-svn-id: trunk@3399 -
This commit is contained in:
parent
9e79b31d5b
commit
8caddb6cbe
@ -1210,7 +1210,15 @@ end;
|
||||
|
||||
function ProgramDirectory: string;
|
||||
begin
|
||||
Result:=ExpandFilename(ExtractFilePath(ReadAllLinks(ParamStr(0),false)));
|
||||
Result:=ParamStr(0);
|
||||
if ExtractFilePath(Result)='' then begin
|
||||
// program was started via PATH
|
||||
Result:=SearchFileInPath(Result,'',GetEnv('PATH'),':');
|
||||
end;
|
||||
// resolve links
|
||||
Result:=ReadAllLinks(Result,false);
|
||||
// extract file path and expand to full name
|
||||
Result:=ExpandFilename(ExtractFilePath(Result));
|
||||
end;
|
||||
|
||||
function CopyFileWithMethods(const SrcFilename, DestFilename: string;
|
||||
|
@ -81,7 +81,7 @@ begin
|
||||
ConfFileName:=SetDirSeparators(GetPrimaryConfigPath+'/'+MiscOptsFilename);
|
||||
CopySecondaryConfigFile(MiscOptsFilename);
|
||||
if (not FileExists(ConfFileName)) then begin
|
||||
writeln('Note: miscellaneous options file not found - using defaults');
|
||||
writeln('NOTE: miscellaneous options file not found - using defaults');
|
||||
end;
|
||||
FFilename:=ConfFilename;
|
||||
end;
|
||||
@ -95,7 +95,7 @@ begin
|
||||
try
|
||||
XMLConfig:=TXMLConfig.Create(GetFilename);
|
||||
except
|
||||
writeln('Error: unable to open miscellaneous options "',GetFilename,'"');
|
||||
writeln('ERROR: unable to open miscellaneous options "',GetFilename,'"');
|
||||
exit;
|
||||
end;
|
||||
try
|
||||
@ -103,14 +103,14 @@ begin
|
||||
FileVersion:=XMLConfig.GetValue('MiscellaneousOptions/Version/Value',0);
|
||||
|
||||
if (FileVersion<MiscOptsVersion) and (FileVersion<>0) then
|
||||
writeln('Note: converting old miscellaneous options ...');
|
||||
writeln('NOTE: converting old miscellaneous options ...');
|
||||
|
||||
BuildLazOpts.Load(XMLConfig,'MiscellaneousOptions/BuildLazarusOptions/');
|
||||
finally
|
||||
XMLConfig.Free;
|
||||
end;
|
||||
except
|
||||
writeln('Error: unable read miscellaneous options from "',GetFilename,'"');
|
||||
writeln('ERROR: unable read miscellaneous options from "',GetFilename,'"');
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -120,7 +120,7 @@ begin
|
||||
try
|
||||
XMLConfig:=TXMLConfig.Create(GetFilename);
|
||||
except
|
||||
writeln('Error: unable to open miscellaneous options "',GetFilename,'"');
|
||||
writeln('ERROR: unable to open miscellaneous options "',GetFilename,'"');
|
||||
exit;
|
||||
end;
|
||||
try
|
||||
@ -134,7 +134,7 @@ begin
|
||||
XMLConfig.Free;
|
||||
end;
|
||||
except
|
||||
writeln('Error: unable read miscellaneous options from "',GetFilename,'"');
|
||||
writeln('ERROR: unable read miscellaneous options from "',GetFilename,'"');
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user