mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 14:09:17 +02:00
* remove GetEnv dependency
git-svn-id: trunk@3729 -
This commit is contained in:
parent
b74142460f
commit
4d9e404403
@ -67,7 +67,7 @@ end;
|
|||||||
|
|
||||||
{$IFDEF FPC_FEXPAND_VOLUMES}
|
{$IFDEF FPC_FEXPAND_VOLUMES}
|
||||||
{$IFNDEF FPC_FEXPAND_NO_DEFAULT_PATHS}
|
{$IFNDEF FPC_FEXPAND_NO_DEFAULT_PATHS}
|
||||||
procedure GetDirIO (const VolumeName: OpenString; var Dir: PathStr);
|
procedure GetDirIO (const VolumeName: OpenString; var Dir: string);
|
||||||
|
|
||||||
var
|
var
|
||||||
OldInOutRes: word;
|
OldInOutRes: word;
|
||||||
@ -91,7 +91,8 @@ function FExpand (const Path: PathStr): PathStr;
|
|||||||
FPC_FEXPAND_NO_DOTS_UPDIR, FPC_FEXPAND_DIRSEP_IS_UPDIR,
|
FPC_FEXPAND_NO_DOTS_UPDIR, FPC_FEXPAND_DIRSEP_IS_UPDIR,
|
||||||
FPC_FEXPAND_DIRSEP_IS_CURDIR and FPC_FEXPAND_MULTIPLE_UPDIR conditionals
|
FPC_FEXPAND_DIRSEP_IS_CURDIR and FPC_FEXPAND_MULTIPLE_UPDIR conditionals
|
||||||
might be defined to specify FExpand behaviour - see end of this file for
|
might be defined to specify FExpand behaviour - see end of this file for
|
||||||
individual descriptions.
|
individual descriptions. Finally, FPC_FEXPAND_SYSUTILS allows to reuse
|
||||||
|
the same implementation for SysUtils.ExpandFileName.
|
||||||
*)
|
*)
|
||||||
|
|
||||||
{$IFDEF FPC_FEXPAND_DRIVES}
|
{$IFDEF FPC_FEXPAND_DRIVES}
|
||||||
@ -161,15 +162,15 @@ begin
|
|||||||
if (Length (Pa) >= 1) and (Pa [1] = '~') and
|
if (Length (Pa) >= 1) and (Pa [1] = '~') and
|
||||||
((Pa [2] = DirectorySeparator) or (Length (Pa) = 1)) then
|
((Pa [2] = DirectorySeparator) or (Length (Pa) = 1)) then
|
||||||
begin
|
begin
|
||||||
{$IFOPT H-}
|
{$IFDEF FPC_FEXPAND_SYSUTILS}
|
||||||
|
S := GetEnvironmentVariable ('HOME');
|
||||||
|
{$ELSE FPC_FEXPAND_SYSUTILS}
|
||||||
{$IFDEF FPC_FEXPAND_GETENV_PCHAR}
|
{$IFDEF FPC_FEXPAND_GETENV_PCHAR}
|
||||||
S := StrPas (GetEnv ('HOME'));
|
S := StrPas (GetEnv ('HOME'));
|
||||||
{$ELSE FPC_FEXPAND_GETENV_PCHAR}
|
{$ELSE FPC_FEXPAND_GETENV_PCHAR}
|
||||||
{$ENDIF H-}
|
|
||||||
S := GetEnv ('HOME');
|
S := GetEnv ('HOME');
|
||||||
{$IFOPT H-}
|
|
||||||
{$ENDIF FPC_FEXPAND_GETENV_PCHAR}
|
{$ENDIF FPC_FEXPAND_GETENV_PCHAR}
|
||||||
{$ENDIF H-}
|
{$ENDIF FPC_FEXPAND_SYSUTILS}
|
||||||
if (S = '') or (Length (S) = 1)
|
if (S = '') or (Length (S) = 1)
|
||||||
and (S [1] = DirectorySeparator) then
|
and (S [1] = DirectorySeparator) then
|
||||||
Delete (Pa, 1, 1)
|
Delete (Pa, 1, 1)
|
||||||
@ -577,5 +578,8 @@ end;
|
|||||||
FPC_FEXPAND_MULTIPLE_UPDIR - grouping of more characters specifying
|
FPC_FEXPAND_MULTIPLE_UPDIR - grouping of more characters specifying
|
||||||
upper directory references higher directory levels. Example: '...'
|
upper directory references higher directory levels. Example: '...'
|
||||||
(Netware).
|
(Netware).
|
||||||
|
|
||||||
|
FPC_FEXPAND_SYSUTILS allows to reuse the same implementation for
|
||||||
|
SysUtils.ExpandFileName by avoiding things specific for unit Dos.
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
@ -94,12 +94,11 @@ else Result := '';
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$ifdef Unix}
|
|
||||||
Function getenv(name:shortstring):Pchar; external name 'FPC_SYSC_FPGETENV';
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
type
|
type
|
||||||
PathStr=string;
|
PathStr=string;
|
||||||
|
|
||||||
|
{$DEFINE FPC_FEXPAND_SYSUTILS}
|
||||||
|
|
||||||
{$I fexpand.inc}
|
{$I fexpand.inc}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user