mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 04:29:25 +02:00
IDE: FindProgram: resolve leading ~ under Unix
git-svn-id: trunk@48132 -
This commit is contained in:
parent
a819e545f5
commit
f93f158c57
@ -4189,6 +4189,7 @@ function TCompilationToolOptions.Execute(const WorkingDir, ToolTitle,
|
||||
var
|
||||
ExtTool: TAbstractExternalTool;
|
||||
begin
|
||||
if Command='' then exit(mrOk);
|
||||
if SourceEditorManagerIntf<>nil then
|
||||
SourceEditorManagerIntf.ClearErrorLines;
|
||||
|
||||
@ -4217,11 +4218,14 @@ var
|
||||
Filename: String;
|
||||
begin
|
||||
CurCommand:=GetParsedCommand;
|
||||
//debugln(['TCompilationToolOptions.CreateExtTool CurCommand=[',CurCommand,']']);
|
||||
if CurCommand='' then
|
||||
exit(nil);
|
||||
SplitCmdLine(CurCommand,ProgramFilename,Params);
|
||||
//debugln(['TCompilationToolOptions.CreateExtTool Prg=[',ProgramFilename,'] Params=[',Params,']']);
|
||||
if not FilenameIsAbsolute(ProgramFilename) then begin
|
||||
Filename:=FindProgram(ProgramFilename,WorkingDir,true);
|
||||
//debugln(['TCompilationToolOptions.CreateExtTool Found=[',Filename,']']);
|
||||
if Filename<>'' then ProgramFilename:=Filename;
|
||||
end;
|
||||
Result:=ExternalToolList.Add(ToolTitle);
|
||||
|
@ -118,7 +118,7 @@ function FindShortFileNameOnDisk(const Filename: string): string;
|
||||
function CreateNonExistingFilename(const BaseFilename: string): string;
|
||||
function FindFPCTool(const Executable, CompilerFilename: string): string;
|
||||
procedure ResolveLinksInFileList(List: TStrings; RemoveDanglingLinks: Boolean);
|
||||
function FindProgram(const Programname, BaseDirectory: string;
|
||||
function FindProgram(ProgramName, BaseDirectory: string;
|
||||
WithBaseDirectory: boolean): string;
|
||||
|
||||
// search paths
|
||||
@ -1501,14 +1501,23 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function FindProgram(const Programname, BaseDirectory: string;
|
||||
function FindProgram(ProgramName, BaseDirectory: string;
|
||||
WithBaseDirectory: boolean): string;
|
||||
var
|
||||
Flags: TSearchFileInPathFlags;
|
||||
begin
|
||||
if FilenameIsAbsolute(Programname) then begin
|
||||
if FileExistsUTF8(Programname) then
|
||||
Result:=Programname
|
||||
Result:='';
|
||||
if ProgramName='' then exit;
|
||||
{$IFDEF Unix}
|
||||
if ProgramName[1]='~' then begin
|
||||
Delete(ProgramName,1,1);
|
||||
ProgramName:=GetEnvironmentVariableUTF8('HOME')+ProgramName;
|
||||
end;
|
||||
{$ENDIF}
|
||||
ProgramName:=ResolveDots(ProgramName);
|
||||
if FilenameIsAbsolute(ProgramName) then begin
|
||||
if FileExistsCached(ProgramName) then
|
||||
Result:=ProgramName
|
||||
else
|
||||
Result:='';
|
||||
exit;
|
||||
@ -1516,7 +1525,7 @@ begin
|
||||
Flags:=[];
|
||||
if not WithBaseDirectory then
|
||||
Include(Flags,sffDontSearchInBasePath);
|
||||
Result:=FileUtil.SearchFileInPath(Programname,BaseDirectory,
|
||||
Result:=FileUtil.SearchFileInPath(ProgramName,BaseDirectory,
|
||||
GetProgramSearchPath,PathSep,Flags);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user