mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 15:08:28 +02:00
lazutils: FindDefaultExecutablePath: on Windows search in BaseDir as well, bug #30802.
git-svn-id: trunk@53236 -
This commit is contained in:
parent
8f692f8a3b
commit
3bcde4474b
@ -976,6 +976,8 @@ end;
|
||||
|
||||
function FindDefaultExecutablePath(const Executable: string;
|
||||
const BaseDir: string): string;
|
||||
const
|
||||
Flags : TSearchFileInPathFlags = [{$IFDEF Unix}sffDontSearchInBasePath{$ENDIF}];
|
||||
begin
|
||||
if LazFileUtils.FilenameIsAbsolute(Executable) then begin
|
||||
Result:=Executable;
|
||||
@ -989,13 +991,13 @@ begin
|
||||
end else begin
|
||||
Result:=SearchFileInPath(Executable,BaseDir,
|
||||
LazUTF8.GetEnvironmentVariableUTF8('PATH'), PathSeparator,
|
||||
[sffDontSearchInBasePath]);
|
||||
Flags);
|
||||
if Result<>'' then exit;
|
||||
{$IFDEF Windows}
|
||||
if ExtractFileExt(Executable)='' then begin
|
||||
Result:=SearchFileInPath(Executable+'.exe',BaseDir,
|
||||
LazUTF8.GetEnvironmentVariableUTF8('PATH'), PathSeparator,
|
||||
[sffDontSearchInBasePath]);
|
||||
Flags);
|
||||
if Result<>'' then exit;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
@ -153,7 +153,7 @@ function ReadFileToString(const Filename: string): string;
|
||||
// file search
|
||||
type
|
||||
TSearchFileInPathFlag = (
|
||||
sffDontSearchInBasePath,
|
||||
sffDontSearchInBasePath, // do not search in BasePath, search only in SearchPath.
|
||||
sffSearchLoUpCase
|
||||
);
|
||||
TSearchFileInPathFlags = set of TSearchFileInPathFlag;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<fpdoc-descriptions>
|
||||
<package name="lazutils">
|
||||
<!--
|
||||
@ -767,20 +767,10 @@ else
|
||||
</element>
|
||||
<!-- function Visibility: default -->
|
||||
<element name="SearchFileInPath">
|
||||
<short>
|
||||
<var>SearchFileInPath</var> - searches for
|
||||
<var>Filename</var> in the given
|
||||
<var>SearchPath</var> using the supplied
|
||||
<var>BasePath</var> with the specified
|
||||
<var>Delimiter</var> and the options listed in
|
||||
<var>Flags</var>
|
||||
<short><var>SearchFileInPath</var> - searches for <var>Filename</var> in the given <var>SearchPath</var> using the supplied <var>BasePath</var> with the specified <var>Delimiter</var> and the options listed in <var>Flags</var>
|
||||
</short>
|
||||
<descr>
|
||||
<p>
|
||||
<printshort id="SearchFileInPath"/>
|
||||
</p>
|
||||
<p>Searches the whole path unless the <var>sffDontSearchInBasePath</var> flag is present</p>
|
||||
<p>Returns the first file that matches the supplied criteria</p>
|
||||
<descr><p><printshort id="SearchFileInPath"/>
|
||||
</p><p>Searches the whole path. Relative folder file names are expanded using BasePath. By default if BasePath is set it is searched as well, unless <var>sffDontSearchInBasePath</var> flag is present</p><p>Returns the first file that matches the supplied criteria</p>
|
||||
</descr>
|
||||
<errors>If the file does not exist, an empty string is returned</errors>
|
||||
</element>
|
||||
@ -891,11 +881,7 @@ else
|
||||
<element name="FindDefaultExecutablePath">
|
||||
<short>
|
||||
<var>FindDefaultExecutablePath</var> - finds the default path to the named Executable file</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>FindDefaultExecutablePath</var> - finds the default path to the named Executable file</p>
|
||||
<p>On Windows systems, looks for the '.EXE' extension</p>
|
||||
<p>In all systems, searches the 'PATH' environment variable to see if the file is in one of the default paths</p>
|
||||
<descr><p><var>FindDefaultExecutablePath</var> - finds the default path to the named Executable file</p><p>On Windows systems it looks for both with and without the '.EXE' extension</p><p>If Executable is not an absolute filename the executable is searched using the environment variable PATH. Relative directories in PATH are expanded using BaseDir.</p><p>On non Unix systems (e.g. Windows) it searches in BaseDir as well. While on Unix systems (e.g. Linux, OS X) it only searches in BaseDir, if PATH contains the '.' directory.</p>
|
||||
</descr>
|
||||
</element>
|
||||
<!-- function result Visibility: default -->
|
||||
|
Loading…
Reference in New Issue
Block a user