* assumption that everything non-Windows uses Unix paths is obviously wrong; fixed

git-svn-id: trunk@29632 -
This commit is contained in:
Tomas Hajny 2015-02-05 14:54:25 +00:00
parent a608070e8d
commit 1bc72d437c
2 changed files with 32 additions and 4 deletions

View File

@ -247,13 +247,33 @@
//--- Conclude supported features in non-Windows platforms ---
//----------------------------------------------------------
{$ifndef WINDOWS}
{$IFDEF WINDOWS}
{$DEFINE SUPPORT_DRIVES_AND_UNC}
{$ELSE WINDOWS}
{$IFDEF LINUX}
{$IFNDEF UNIX}
{$DEFINE UNIX}
{$ENDIF UNIX}
{$ENDIF LINUX}
{$IFDEF OS2}
{$DEFINE SUPPORT_DRIVES_AND_UNC}
{$ENDIF OS2}
{$IFDEF GO32V2}
{$DEFINE SUPPORT_DRIVES_AND_UNC}
{$ENDIF GO32V2}
{$IFDEF WATCOM}
{$DEFINE SUPPORT_DRIVES_AND_UNC}
{$ENDIF WATCOM}
{$IFDEF MSDOS}
{$DEFINE SUPPORT_DRIVES_AND_UNC}
{$ENDIF MSDOS}
{$define SUPPORT_PATHDELIM}
{$define SUPPORT_INCLUDETRAILPATHDELIM}
{$define SUPPORT_INCLUDETRAILBACKSLASH}
{$endif}
{$ENDIF WINDOWS}
{$ifndef ENDIAN_LITTLE}
{$ifndef ENDIAN_BIG}

View File

@ -67,7 +67,11 @@ const
{$ifdef WINDOWS}
PathDelim = '\';
{$else}
{$IFDEF UNIX}
PathDelim = '/';
{$ELSE UNIX}
PathDelim = '\';
{$ENDIF UNIX}
{$endif}
{$endif}
@ -145,13 +149,13 @@ end;
function IsFullFilePath(const Path: string): Boolean; // full means not relative
begin
{$ifdef WINDOWS}
{$ifdef SUPPORT_DRIVES_AND_UNC}
Result := Length(Path) > 1;
if Result then
// check for 'x:' or '\\' at start of path
Result := ((Path[2]=':') and (upcase(Path[1]) in ['A'..'Z']))
or ((Path[1]='\') and (Path[2]='\'));
{$else} // Linux
{$else} // Linux / Unix
Result := Length(Path) > 0;
if Result then
Result := Path[1]='/';
@ -236,7 +240,11 @@ begin
{$ifdef WINDOWS}
Result := IncludeTrailingBackslash(Path);
{$else}
{$IFDEF UNIX}
Result := IncludeTrailingSlash(Path);
{$ELSE UNIX}
Result := IncludeTrailingBackslash(Path);
{$ENDIF UNIX}
{$endif}
end;