From 1bc72d437c6aa8a9cca580b1c1c23cac73161e63 Mon Sep 17 00:00:00 2001 From: Tomas Hajny Date: Thu, 5 Feb 2015 14:54:25 +0000 Subject: [PATCH] * assumption that everything non-Windows uses Unix paths is obviously wrong; fixed git-svn-id: trunk@29632 - --- packages/fcl-db/src/dbase/dbf_common.inc | 24 ++++++++++++++++++++++-- packages/fcl-db/src/dbase/dbf_common.pas | 12 ++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/packages/fcl-db/src/dbase/dbf_common.inc b/packages/fcl-db/src/dbase/dbf_common.inc index 0b12c936ca..868b70669a 100644 --- a/packages/fcl-db/src/dbase/dbf_common.inc +++ b/packages/fcl-db/src/dbase/dbf_common.inc @@ -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} diff --git a/packages/fcl-db/src/dbase/dbf_common.pas b/packages/fcl-db/src/dbase/dbf_common.pas index b12442bd1f..8c8f18b24d 100644 --- a/packages/fcl-db/src/dbase/dbf_common.pas +++ b/packages/fcl-db/src/dbase/dbf_common.pas @@ -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;