Browse Source

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

git-svn-id: trunk@29632 -
Tomas Hajny 10 years ago
parent
commit
1bc72d437c

+ 22 - 2
packages/fcl-db/src/dbase/dbf_common.inc

@@ -247,13 +247,33 @@
 //--- Conclude supported features in non-Windows platforms ---
 //--- 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_PATHDELIM}
     {$define SUPPORT_INCLUDETRAILPATHDELIM}
     {$define SUPPORT_INCLUDETRAILPATHDELIM}
     {$define SUPPORT_INCLUDETRAILBACKSLASH}
     {$define SUPPORT_INCLUDETRAILBACKSLASH}
 
 
-{$endif}
+{$ENDIF WINDOWS}
 
 
 {$ifndef ENDIAN_LITTLE}
 {$ifndef ENDIAN_LITTLE}
 {$ifndef ENDIAN_BIG}
 {$ifndef ENDIAN_BIG}

+ 10 - 2
packages/fcl-db/src/dbase/dbf_common.pas

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