Mattias Gaertner wrote:
Hi all,
ExtractFilePath and ExtractFileDir stops at last '/','\', so it treats the
normal character \ as path delimiter under Unix.
Is there a RTL function that handles the \ as normal character?
You can change global AllowDirectorySeparators
(http://www.freepascal.org/docs-html/rtl/system/allowdirectoryseparators.html
) to exclude '\' on non-Windows. I do this in my engine:
{$ifndef MSWINDOWS}
AllowDirectorySeparators -= ['\'];
{$endif}
This way ExtractFilePath and friends behave correctly on non-Windows.
And I really, really wish this would be changed in FPC too... That is,
AllowDirectorySeparators should be ['/'] on Unix, not ['/','\'].
Backslash is a completely normal character in Unix filenames. The
default value of AllowDirectorySeparators variable *should* be
OS-dependent, just like PathDelim and others.
Michalis
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal