fexpand.inc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1997-2000 by the Free Pascal development team
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {****************************************************************************
  12. A platform independent FExpand implementation
  13. ****************************************************************************}
  14. {$IFDEF FPC_FEXPAND_VOLUMES}
  15. {$IFNDEF FPC_FEXPAND_DRIVES}
  16. (* Volumes are just a special case of drives. *)
  17. {$DEFINE FPC_FEXPAND_DRIVES}
  18. {$ENDIF FPC_FEXPAND_DRIVES}
  19. {$ENDIF FPC_FEXPAND_VOLUMES}
  20. {$IFDEF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  21. {$IFNDEF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  22. (* If DriveSeparator is used for upper directory, *)
  23. (* it cannot be used for marking root at the same time. *)
  24. {$DEFINE FPC_FEXPAND_DRIVESEP_IS_ROOT}
  25. {$ENDIF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  26. {$ENDIF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  27. procedure GetDirIO (DriveNr: byte; var Dir: OpenString);
  28. (* GetDirIO is supposed to return the root of the given drive *)
  29. (* in case of an error for compatibility of FExpand with TP/BP. *)
  30. var
  31. OldInOutRes: word;
  32. begin
  33. OldInOutRes := InOutRes;
  34. InOutRes := 0;
  35. GetDir (DriveNr, Dir);
  36. InOutRes := OldInOutRes;
  37. end;
  38. {$IFDEF FPC_FEXPAND_VOLUMES}
  39. {$IFNDEF FPC_FEXPAND_NO_DEFAULT_PATHS}
  40. procedure GetDirIO (const VolumeName: OpenString; var Dir: OpenString);
  41. var
  42. OldInOutRes: word;
  43. begin
  44. OldInOutRes := InOutRes;
  45. InOutRes := 0;
  46. GetDir (VolumeName, Dir);
  47. InOutRes := OldInOutRes;
  48. end;
  49. {$ENDIF FPC_FEXPAND_NO_DEFAULT_PATHS}
  50. {$ENDIF FPC_FEXPAND_VOLUMES}
  51. function FExpand (const Path: PathStr): PathStr;
  52. (* LFNSupport boolean constant, variable or function must be declared for all
  53. the platforms, at least locally in the Dos unit implementation part.
  54. In addition, FPC_FEXPAND_UNC, FPC_FEXPAND_DRIVES, FPC_FEXPAND_GETENV_PCHAR,
  55. FPC_FEXPAND_TILDE, FPC_FEXPAND_VOLUMES, FPC_FEXPAND_NO_DEFAULT_PATHS,
  56. FPC_FEXPAND_DRIVESEP_IS_ROOT, FPC_FEXPAND_NO_CURDIR,
  57. FPC_FEXPAND_NO_DOTS_UPDIR and FPC_FEXPAND_DIRSEP_IS_UPDIR conditionals might
  58. be defined to specify FExpand behaviour - see end of this file for
  59. individual descriptions.
  60. *)
  61. {$IFDEF FPC_FEXPAND_DRIVES}
  62. var
  63. PathStart: longint;
  64. {$ELSE FPC_FEXPAND_DRIVES}
  65. const
  66. PathStart = 1;
  67. {$ENDIF FPC_FEXPAND_DRIVES}
  68. {$IFDEF FPC_FEXPAND_UNC}
  69. var
  70. RootNotNeeded: boolean;
  71. {$ELSE FPC_FEXPAND_UNC}
  72. const
  73. RootNotNeeded = false;
  74. {$ENDIF FPC_FEXPAND_UNC}
  75. var S, Pa, Dirs: PathStr;
  76. I, J: longint;
  77. begin
  78. {$IFDEF FPC_FEXPAND_UNC}
  79. RootNotNeeded := false;
  80. {$ENDIF FPC_FEXPAND_UNC}
  81. (* First convert the path to uppercase if appropriate for current platform. *)
  82. if FileNameCaseSensitive then
  83. Pa := Path
  84. else
  85. Pa := UpCase (Path);
  86. (* Allow both '/' and '\' as directory separators *)
  87. (* by converting all to the native one. *)
  88. if DirectorySeparator = '\' then
  89. {Allow slash as backslash}
  90. begin
  91. for I := 1 to Length (Pa) do
  92. if Pa [I] = '/' then
  93. Pa [I] := DirectorySeparator
  94. end
  95. else
  96. {Allow backslash as slash}
  97. begin
  98. for I := 1 to Length (Pa) do
  99. if Pa [I] = '\' then
  100. Pa [I] := DirectorySeparator;
  101. end;
  102. (* PathStart is amount of characters to strip to get beginning *)
  103. (* of path without volume/drive specification. *)
  104. {$IFDEF FPC_FEXPAND_DRIVES}
  105. {$IFDEF FPC_FEXPAND_VOLUMES}
  106. {$IFDEF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  107. PathStart := Pos (DriveSeparator, Pa);
  108. {$ELSE FPC_FEXPAND_DRIVESEP_IS_ROOT}
  109. PathStart := Succ (Pos (DriveSeparator, Pa));
  110. {$ENDIF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  111. {$ELSE FPC_FEXPAND_VOLUMES}
  112. PathStart := 3;
  113. {$ENDIF FPC_FEXPAND_VOLUMES}
  114. {$ENDIF FPC_FEXPAND_DRIVES}
  115. (* Expand tilde to home directory if appropriate. *)
  116. {$IFDEF FPC_FEXPAND_TILDE}
  117. {Replace ~/ with $HOME/}
  118. if (Length (Pa) >= 1) and (Pa [1] = '~') and
  119. ((Pa [2] = DirectorySeparator) or (Length (Pa) = 1)) then
  120. begin
  121. {$IFDEF FPC_FEXPAND_GETENV_PCHAR}
  122. S := StrPas (GetEnv ('HOME'));
  123. {$ELSE FPC_FEXPAND_GETENV_PCHAR}
  124. S := GetEnv ('HOME');
  125. {$ENDIF FPC_FEXPAND_GETENV_PCHAR}
  126. if (S = '') or (Length (S) = 1)
  127. and (S [1] = DirectorySeparator) then
  128. Delete (Pa, 1, 1)
  129. else
  130. if S [Length (S)] = DirectorySeparator then
  131. Pa := S + Copy (Pa, 3, Length (Pa) - 2)
  132. else
  133. Pa := S + Copy (Pa, 2, Pred (Length (Pa)));
  134. end;
  135. {$ENDIF FPC_FEXPAND_TILDE}
  136. (* Do we have a drive/volume specification? *)
  137. {$IFDEF FPC_FEXPAND_VOLUMES}
  138. if PathStart > 1 then
  139. {$ELSE FPC_FEXPAND_VOLUMES}
  140. if (Length (Pa) > 1) and (Pa [1] in ['A'..'Z', 'a'..'z']) and
  141. (Pa [2] = DriveSeparator) then
  142. {$ENDIF FPC_FEXPAND_VOLUMES}
  143. begin
  144. (* We need to know current directory on given *)
  145. (* volume/drive _if_ such a thing is defined. *)
  146. {$IFDEF FPC_FEXPAND_DRIVES}
  147. {$IFNDEF FPC_FEXPAND_NO_DEFAULT_PATHS}
  148. {$IFDEF FPC_FEXPAND_VOLUMES}
  149. GetDirIO (Copy (Pa, 1, PathStart - 2), S);
  150. {$ELSE FPC_FEXPAND_VOLUMES}
  151. { Always uppercase driveletter }
  152. if (Pa [1] in ['a'..'z']) then
  153. Pa [1] := Chr (Ord (Pa [1]) and not ($20));
  154. GetDirIO (Ord (Pa [1]) - Ord ('A') + 1, S);
  155. {$ENDIF FPC_FEXPAND_VOLUMES}
  156. (* Do we have more than just drive/volume specification? *)
  157. if Length (Pa) = Pred (PathStart) then
  158. (* If not, just use the current directory for that drive/volume. *)
  159. Pa := S
  160. else
  161. (* If yes, find out whether the following path is relative or absolute. *)
  162. if Pa [PathStart] <> DirectorySeparator then
  163. {$IFDEF FPC_FEXPAND_VOLUMES}
  164. if Copy (Pa, 1, PathStart - 2) = Copy (S, 1, PathStart - 2)
  165. then
  166. {$ELSE FPC_FEXPAND_VOLUMES}
  167. if Pa [1] = S [1] then
  168. {$ENDIF FPC_FEXPAND_VOLUMES}
  169. begin
  170. { remove ending slash if it already exists }
  171. if S [Length (S)] = DirectorySeparator then
  172. Dec (S [0]);
  173. Pa := S + DirectorySeparator +
  174. Copy (Pa, PathStart, Length (Pa) - PathStart + 1)
  175. end
  176. else
  177. {$IFDEF FPC_FEXPAND_VOLUMES}
  178. Pa := Copy (Pa, 1, PathStart - 2) + DriveSeparator
  179. + DirectorySeparator +
  180. Copy (Pa, PathStart, Length (Pa) - PathStart + 1)
  181. {$ELSE FPC_FEXPAND_VOLUMES}
  182. Pa := Pa [1] + DriveSeparator + DirectorySeparator +
  183. Copy (Pa, PathStart, Length (Pa) - PathStart + 1)
  184. {$ENDIF FPC_FEXPAND_VOLUMES}
  185. {$ENDIF FPC_FEXPAND_NO_DEFAULT_PATHS}
  186. end
  187. else
  188. {$ELSE FPC_FEXPAND_DRIVES}
  189. (* If drives are not supported, but a drive *)
  190. (* was supplied anyway, ignore (remove) it. *)
  191. Delete (Pa, 1, 2);
  192. end;
  193. {Check whether we don't have an absolute path already}
  194. if (Length (Pa) >= PathStart) and (Pa [PathStart] <> DirectorySeparator) or
  195. (Length (Pa) < PathStart) then
  196. {$ENDIF FPC_FEXPAND_DRIVES}
  197. begin
  198. (* Get current directory on selected drive/volume. *)
  199. GetDirIO (0, S);
  200. {$IFDEF FPC_FEXPAND_VOLUMES}
  201. {$IFDEF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  202. PathStart := Pos (DriveSeparator, S);
  203. {$ELSE FPC_FEXPAND_DRIVESEP_IS_ROOT}
  204. PathStart := Succ (Pos (DriveSeparator, S));
  205. {$ENDIF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  206. {$ENDIF FPC_FEXPAND_VOLUMES}
  207. (* Do we have an absolute path? *)
  208. {$IFDEF FPC_FEXPAND_DRIVES}
  209. if (Length (Pa) > 0)
  210. {$IFDEF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  211. and (Pa [1] = DriveSeparator)
  212. {$ELSE FPC_FEXPAND_DRIVESEP_IS_ROOT}
  213. and (Pa [1] = DirectorySeparator)
  214. {$ENDIF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  215. then
  216. begin
  217. {$IFDEF FPC_FEXPAND_UNC}
  218. {Do not touch network drive names}
  219. if (Length (Pa) > 1) and (Pa [2] = DirectorySeparator)
  220. and LFNSupport then
  221. begin
  222. PathStart := 3;
  223. {Find the start of the string of directories}
  224. while (PathStart <= Length (Pa)) and
  225. (Pa [PathStart] <> DirectorySeparator) do
  226. Inc (PathStart);
  227. if PathStart > Length (Pa) then
  228. {We have just a machine name...}
  229. if Length (Pa) = 2 then
  230. {...or not even that one}
  231. PathStart := 2
  232. else
  233. Pa := Pa + DirectorySeparator else
  234. if PathStart < Length (Pa) then
  235. {We have a resource name as well}
  236. begin
  237. RootNotNeeded := true;
  238. {Let's continue in searching}
  239. repeat
  240. Inc (PathStart);
  241. until (PathStart > Length (Pa)) or
  242. (Pa [PathStart] = DirectorySeparator);
  243. end;
  244. end
  245. else
  246. {$ENDIF FPC_FEXPAND_UNC}
  247. {$IFDEF FPC_FEXPAND_VOLUMES}
  248. begin
  249. I := Pos (DriveSeparator, S);
  250. {$IFDEF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  251. {$IFDEF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  252. if (Pa [1] = DriveSeparator) then
  253. Delete (Pa, 1, 1);
  254. {$ENDIF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  255. Pa := Copy (S, 1, I) + Pa;
  256. PathStart := I;
  257. {$ELSE FPC_FEXPAND_DIRSEP_IS_UPDIR}
  258. Pa := Copy (S, 1, Pred (I)) + DriveSeparator + Pa;
  259. PathStart := Succ (I);
  260. {$ENDIF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  261. end;
  262. {$ELSE FPC_FEXPAND_VOLUMES}
  263. Pa := S [1] + DriveSeparator + Pa;
  264. {$ENDIF FPC_FEXPAND_VOLUMES}
  265. end
  266. else
  267. {$ENDIF FPC_FEXPAND_DRIVES}
  268. (* We already have a slash if root is the curent directory. *)
  269. if Length (S) = PathStart then
  270. Pa := S + Pa
  271. else
  272. (* We need an ending slash if FExpand was called *)
  273. (* with an empty string for compatibility, except *)
  274. (* for platforms where this is invalid. *)
  275. if Length (Pa) = 0 then
  276. {$IFDEF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  277. Pa := S
  278. {$ELSE FPC_FEXPAND_DIRSEP_IS_UPDIR}
  279. Pa := S + DirectorySeparator
  280. {$ENDIF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  281. else
  282. {$IFDEF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  283. if Pa [1] = DirectorySeparator then
  284. Pa := S + Pa
  285. else
  286. {$ENDIF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  287. Pa := S + DirectorySeparator + Pa;
  288. end;
  289. {Get string of directories to only process relative references on this one}
  290. Dirs := Copy (Pa, Succ (PathStart), Length (Pa) - PathStart);
  291. {$IFNDEF FPC_FEXPAND_NO_CURDIR}
  292. {First remove all references to '\.\'}
  293. I := Pos (DirectorySeparator + '.' + DirectorySeparator, Dirs);
  294. while I <> 0 do
  295. begin
  296. Delete (Dirs, I, 2);
  297. I := Pos (DirectorySeparator + '.' + DirectorySeparator, Dirs);
  298. end;
  299. {$ENDIF FPC_FEXPAND_NO_CURDIR}
  300. {$IFNDEF FPC_FEXPAND_NO_DOTS_UPDIR}
  301. {Now remove also all references to '\..\' + of course previous dirs..}
  302. I := Pos (DirectorySeparator + '..' + DirectorySeparator, Dirs);
  303. while I <> 0 do
  304. begin
  305. J := Pred (I);
  306. while (J > 0) and (Dirs [J] <> DirectorySeparator) do
  307. Dec (J);
  308. Delete (Dirs, Succ (J), I - J + 3);
  309. I := Pos (DirectorySeparator + '..' + DirectorySeparator, Dirs);
  310. end;
  311. {$ENDIF FPC_FEXPAND_NO_DOTS_UPDIR}
  312. {$IFDEF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  313. (* Now remove all references to '//' plus previous directories... *)
  314. I := Pos (DirectorySeparator + DirectorySeparator, Dirs);
  315. while I <> 0 do
  316. begin
  317. J := Pred (I);
  318. while (J > 0) and (Dirs [J] <> DirectorySeparator) do
  319. Dec (J);
  320. Delete (Dirs, Succ (J), Succ (I - J));
  321. I := Pos (DirectorySeparator + DirectorySeparator, Dirs);
  322. end;
  323. {$ENDIF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  324. {$IFNDEF FPC_FEXPAND_NO_DOTS_UPDIR}
  325. {Then remove also a reference to '\..' at the end of line
  326. + the previous directory, of course,...}
  327. I := Pos (DirectorySeparator + '..', Dirs);
  328. if (I <> 0) and (I = Length (Dirs) - 2) then
  329. begin
  330. J := Pred (I);
  331. while (J > 0) and (Dirs [J] <> DirectorySeparator) do
  332. Dec (J);
  333. if (J = 0) then
  334. Dirs := ''
  335. else
  336. Delete (Dirs, Succ (J), I - J + 2);
  337. end;
  338. {$ENDIF FPC_FEXPAND_NO_DOTS_UPDIR}
  339. {$IFDEF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  340. (* Remove a possible reference to '/' at the *)
  341. (* end of line plus the previous directory. *)
  342. I := Length (Dirs);
  343. if (I > 0) and (Dirs [I] = DirectorySeparator) then
  344. begin
  345. J := Pred (I);
  346. while (J > 0) and (Dirs [J] <> DirectorySeparator) do
  347. Dec (J);
  348. if (J = 0) then
  349. Dirs := ''
  350. else
  351. Delete (Dirs, J, Succ (I - J));
  352. end;
  353. {$ENDIF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  354. {$IFNDEF FPC_FEXPAND_NO_CURDIR}
  355. {...and also a possible reference to '\.'}
  356. if (Length (Dirs) = 1) then
  357. begin
  358. if (Dirs [1] = '.') then
  359. {A special case}
  360. Dirs := ''
  361. end
  362. else
  363. if (Length (Dirs) <> 0) and (Dirs [Length (Dirs)] = '.') and
  364. (Dirs [Pred (Length (Dirs))] = DirectorySeparator) then
  365. Dec (Dirs [0], 2);
  366. {Finally remove '.\' at the beginning of the string of directories...}
  367. while (Length (Dirs) >= 2) and (Dirs [1] = '.')
  368. and (Dirs [2] = DirectorySeparator) do
  369. Delete (Dirs, 1, 2);
  370. {$ENDIF FPC_FEXPAND_NO_CURDIR}
  371. {$IFDEF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  372. (* Remove possible (invalid) references to '/' at the beginning. *)
  373. while (Length (Dirs) >= 1) and (Dirs [1] = '/') do
  374. Delete (Dirs, 1, 1);
  375. {$ENDIF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  376. {$IFNDEF FPC_FEXPAND_NO_DOTS_UPDIR}
  377. {...and possible (invalid) references to '..\' as well}
  378. while (Length (Dirs) >= 3) and (Dirs [1] = '.') and (Dirs [2] = '.') and
  379. (Dirs [3] = DirectorySeparator) do
  380. Delete (Dirs, 1, 3);
  381. {$ENDIF FPC_FEXPAND_NO_DOTS_UPDIR}
  382. {Two special cases - '.' and '..' alone}
  383. {$IFNDEF FPC_FEXPAND_NO_CURDIR}
  384. if (Length (Dirs) = 1) and (Dirs [1] = '.') then
  385. Dirs := '';
  386. {$ENDIF FPC_FEXPAND_NO_CURDIR}
  387. {$IFNDEF FPC_FEXPAND_NO_DOTS_UPDIR}
  388. if (Length (Dirs) = 2) and (Dirs [1] = '.') and (Dirs [2] = '.') then
  389. Dirs := '';
  390. {$ENDIF FPC_FEXPAND_NO_DOTS_UPDIR}
  391. {Join the parts back to create the complete path}
  392. if Length (Dirs) = 0 then
  393. begin
  394. Pa := Copy (Pa, 1, PathStart);
  395. {$IFNDEF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  396. if Pa [PathStart] <> DirectorySeparator then
  397. Pa := Pa + DirectorySeparator;
  398. {$ENDIF FPC_FEXPAND_DRIVESEP_IS_ROOT}
  399. end
  400. else
  401. Pa := Copy (Pa, 1, PathStart) + Dirs;
  402. {$IFNDEF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  403. {Remove ending \ if not supplied originally, the original string
  404. wasn't empty (to stay compatible) and if not really needed}
  405. if (Pa [Length (Pa)] = DirectorySeparator)
  406. and ((Length (Pa) > PathStart) or
  407. {A special case with UNC paths}
  408. (RootNotNeeded and (Length (Pa) = PathStart))) and
  409. (Length (Path) <> 0)
  410. and (Path [Length (Path)] <> DirectorySeparator) then
  411. Dec (Pa [0]);
  412. {$ENDIF FPC_FEXPAND_DIRSEP_IS_UPDIR}
  413. FExpand := Pa;
  414. end;
  415. (* Description of individual conditional defines supported for FExpand
  416. (disregard the used directory separators in examples, constant
  417. System.DirectorySeparator is used in the real implemenation, of course):
  418. FPC_FEXPAND_UNC - UNC ("Universal Naming Convention") paths are
  419. supported (usually used for networking, used in DOS (with
  420. networking support installed), OS/2, Win32 and at least some
  421. Netware versions as far as I remember. An example of such a path
  422. is '\\servername\sharename\some\path'.
  423. FPC_FEXPAND_DRIVES - drive letters are supported (DOS-like
  424. environments - DOS, OS/2, Win32). Example is 'C:\TEST'.
  425. FPC_FEXPAND_GETENV_PCHAR - an implementation of GetEnv returning
  426. PChar instead of a shortstring is available (Unix) to support
  427. long values of environment variables.
  428. FPC_FEXPAND_TILDE - expansion of '~/' to GetEnv('HOME') - Unix.
  429. Example: '~/some/path'.
  430. FPC_FEXPAND_VOLUMES - volumes are supported (similar to drives,
  431. but the name can be longer; used under Netware, Amiga and
  432. probably MacOS as far as I understand it correctly). Example:
  433. 'VolumeName:Some:Path' or 'ServerName/Volume:Some\Path'
  434. (Netware).
  435. FPC_FEXPAND_NO_DEFAULT_PATHS - Dos keeps information about the
  436. current directory for every drive. If some platform supports
  437. drives or volumes, but keeps no track of current directories for
  438. them (i.e. there's no support for "GetDir(DriveNumber, Dir)" or
  439. "GetDir(Volume, Dir)", but only for "GetDir (0, Dir)" (i.e. the
  440. overall current directory), you should define this. Otherwise
  441. constructs like 'C:Some\Path' refer a path relative to the
  442. current directory on the C: drive.
  443. FPC_FEXPAND_DRIVESEP_IS_ROOT - this means that DriveSeparator
  444. should be used as beginning of the "real" path for a particular
  445. drive or volume instead of the DirectorySeparator. This would be
  446. used in case that there is only one character (DriveSeparator)
  447. delimiting the drive letter or volume name from the remaining
  448. path _and_ the DriveSeparator marks the root of an absolute path.
  449. Example - 'Volume:This/Is/Absolute/Path'.
  450. FPC_FEXPAND_NO_CURDIR - there is no support to refer to current
  451. directory explicitely (like '.' used under both Unix and DOS-like
  452. environments).
  453. FPC_FEXPAND_NO_DOTS_UPDIR - '..' cannot be used to refer to the
  454. upper directory.
  455. FPC_FEXPAND_DIRSEP_IS_UPDIR - DirectorySeparator at the beginning of a
  456. path (or doubled DirectorySeparator inside the path) refer to the
  457. upper directory. Please, note that you can decide to support both '..'
  458. and DirectorySeparator as references to the parent directory at the
  459. same time for compatibility reasons (although that means that you'd
  460. make it impossible to use an otherwise valid name of '..').
  461. *)
  462. {
  463. $Log$
  464. Revision 1.16 2004-05-29 18:25:21 hajny
  465. * description of individual conditional defines added
  466. Revision 1.15 2002/12/07 16:26:39 hajny
  467. * '//' behaviour for Amiga corrected
  468. Revision 1.14 2002/12/01 20:46:44 hajny
  469. * Amiga support hopefully finished
  470. Revision 1.13 2002/11/25 21:03:57 hajny
  471. * Amiga fixes (among others)
  472. Revision 1.12 2002/11/24 15:49:22 hajny
  473. * make use of constants available in the system unit
  474. Revision 1.11 2002/09/07 15:07:45 peter
  475. * old logs removed and tabs fixed
  476. Revision 1.10 2002/05/14 19:25:24 hajny
  477. * fix for bug 1964 merged
  478. Revision 1.9 2002/03/03 15:19:36 carl
  479. * fixes unix conversion of slashes
  480. }