mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Load library from system PATH
(cherry picked from commit 9f2e26306e)
This commit is contained in:
parent
4a9b928ba8
commit
bde8179846
1 changed files with 32 additions and 1 deletions
|
|
@ -146,6 +146,10 @@ function FileIsReadOnly(iAttr: TFileAttrs): Boolean; inline;
|
|||
The path '/tmp' must already exist.)
|
||||
}
|
||||
function GetTempName(PathPrefix: String; Extension: String = 'tmp'): String;
|
||||
{en
|
||||
Find file in the system PATH
|
||||
}
|
||||
function FindInSystemPath(var FileName: String): Boolean;
|
||||
{en
|
||||
Extract file root directory
|
||||
@param(FileName File name)
|
||||
|
|
@ -670,6 +674,26 @@ begin
|
|||
until not mbFileSystemEntryExists(Result);
|
||||
end;
|
||||
|
||||
function FindInSystemPath(var FileName: String): Boolean;
|
||||
var
|
||||
I: Integer;
|
||||
Path, FullName: String;
|
||||
Value: TDynamicStringArray;
|
||||
begin
|
||||
Path:= mbGetEnvironmentVariable('PATH');
|
||||
Value:= SplitString(Path, PathSeparator);
|
||||
for I:= Low(Value) to High(Value) do
|
||||
begin
|
||||
FullName:= IncludeTrailingPathDelimiter(Value[I]) + FileName;
|
||||
if mbFileExists(FullName) then
|
||||
begin
|
||||
FileName:= FullName;
|
||||
Exit(True);
|
||||
end;
|
||||
end;
|
||||
Result:= False;
|
||||
end;
|
||||
|
||||
function ExtractRootDir(const FileName: String): String;
|
||||
{$IFDEF UNIX}
|
||||
begin
|
||||
|
|
@ -1788,9 +1812,16 @@ const
|
|||
PATH_ENV = 'PATH';
|
||||
var
|
||||
APath: String;
|
||||
FullName: String;
|
||||
usName: UnicodeString;
|
||||
begin
|
||||
usName:= CeUtf8ToUtf16(Name);
|
||||
FullName:= Name;
|
||||
|
||||
if GetPathType(Name) = ptNone then
|
||||
begin
|
||||
FindInSystemPath(FullName);
|
||||
end;
|
||||
usName:= CeUtf8ToUtf16(FullName);
|
||||
|
||||
if CheckWin32Version(10)then
|
||||
begin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue