lazutils: ChompPathDelim: under windows: do not chomp UNC base path double slash

git-svn-id: trunk@34374 -
This commit is contained in:
mattias 2011-12-23 19:19:59 +00:00
parent 7b40b6ff7e
commit 77c557782e
2 changed files with 11 additions and 3 deletions

View File

@ -1404,7 +1404,7 @@ begin
if DoReference then
Result.Reference;
end else if DoReference or CreateIfNotExists then begin
Dir:=FindDiskFilename(ChompPathDelim(TrimFilename(Directory)));
Dir:=FindDiskFilename(Directory);
Result:=TCTDirectoryCache.Create(Dir,Self);
FDirectories.Add(Result);
if DoReference then

View File

@ -7,9 +7,13 @@ interface
uses
Classes, SysUtils, LazUTF8, LUResStrings;
{$if defined(Windows) or defined(darwin)}
{$IFDEF Windows}
{$define CaseInsensitiveFilenames}
{$endif}
{$define HasUNCPaths}
{$ENDIF}
{$IFDEF darwin}
{$define CaseInsensitiveFilenames}
{$ENDIF}
{$IF defined(CaseInsensitiveFilenames) or defined(darwin)}
{$DEFINE NotLiteralFilenames} // e.g. HFS+ normalizes file names
{$ENDIF}
@ -853,6 +857,10 @@ begin
Result:=Path;
Len:=length(Result);
while (Len>1) and (Result[Len]=PathDelim) do dec(Len);
{$IFDEF HasUNCPaths}
if (Len=1) and (Result[1]=PathDelim) then
Len:=2; // keep UNC '\\', chomp 'a\' to 'a'
{$ENDIF}
if Len<length(Result) then
SetLength(Result,Len);
end;