From fa0bc075f4f3cfc841f4003914ce729820b09d22 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sat, 28 Nov 2009 23:14:52 +0100 Subject: 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. --- UCoreUtils.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'UCoreUtils.pas') 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; -- cgit v1.2.3