summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2009-11-28 23:14:52 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2009-11-28 23:14:52 +0100
commitfa0bc075f4f3cfc841f4003914ce729820b09d22 (patch)
tree570a99d2ff8cd4907818df3d1c4bfd61693d68d1
parentf1d6b58cb9355ca655d5365505b1f725a89808c6 (diff)
downloadtuxcmd-fa0bc075f4f3cfc841f4003914ce729820b09d22.tar.xz
Set allowed path delimiters to a forward slash only
This is a workaround for FPC RTL bug, a declination from Borland standards. It will allow us to have directories ending with a backslash.
-rw-r--r--UCoreUtils.pas8
1 files changed, 7 insertions, 1 deletions
diff --git a/UCoreUtils.pas b/UCoreUtils.pas
index 203fbc7..f319d44 100644
--- a/UCoreUtils.pas
+++ b/UCoreUtils.pas
@@ -1590,7 +1590,7 @@ var bytes_read, bytes_written: gsize;
m: PChar;
begin
if g_utf8_validate(s, strlen(s), nil) then begin
- Result := strndup(s, strlen(s));
+ Result := strdup(s);
Exit;
end;
// DebugMsg(['StrToUTF8: string "', s, '" is not valid UTF-8.']);
@@ -1869,6 +1869,12 @@ end;
initialization
+{$IFDEF FPC}
+ // Set path separators only to a standard Unix slash -- otherwise all path functions will treat ending backslash as a delimiter,
+ // causing problems with directory names ending with a backslash (it's a valid character in Unix).
+ // Kylix behaves fine, only forward slash is honored.
+ AllowDirectorySeparators := ['/'];
+{$ENDIF}
InternalLockInit(True);
SetupSignals;