mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-24 06:19:47 +01:00
lazutils: ChompPathDelim: under windows: do not chomp UNC base path double slash
git-svn-id: trunk@34374 -
This commit is contained in:
parent
7b40b6ff7e
commit
77c557782e
@ -1404,7 +1404,7 @@ begin
|
|||||||
if DoReference then
|
if DoReference then
|
||||||
Result.Reference;
|
Result.Reference;
|
||||||
end else if DoReference or CreateIfNotExists then begin
|
end else if DoReference or CreateIfNotExists then begin
|
||||||
Dir:=FindDiskFilename(ChompPathDelim(TrimFilename(Directory)));
|
Dir:=FindDiskFilename(Directory);
|
||||||
Result:=TCTDirectoryCache.Create(Dir,Self);
|
Result:=TCTDirectoryCache.Create(Dir,Self);
|
||||||
FDirectories.Add(Result);
|
FDirectories.Add(Result);
|
||||||
if DoReference then
|
if DoReference then
|
||||||
|
|||||||
@ -7,9 +7,13 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, LazUTF8, LUResStrings;
|
Classes, SysUtils, LazUTF8, LUResStrings;
|
||||||
|
|
||||||
{$if defined(Windows) or defined(darwin)}
|
{$IFDEF Windows}
|
||||||
{$define CaseInsensitiveFilenames}
|
{$define CaseInsensitiveFilenames}
|
||||||
{$endif}
|
{$define HasUNCPaths}
|
||||||
|
{$ENDIF}
|
||||||
|
{$IFDEF darwin}
|
||||||
|
{$define CaseInsensitiveFilenames}
|
||||||
|
{$ENDIF}
|
||||||
{$IF defined(CaseInsensitiveFilenames) or defined(darwin)}
|
{$IF defined(CaseInsensitiveFilenames) or defined(darwin)}
|
||||||
{$DEFINE NotLiteralFilenames} // e.g. HFS+ normalizes file names
|
{$DEFINE NotLiteralFilenames} // e.g. HFS+ normalizes file names
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -853,6 +857,10 @@ begin
|
|||||||
Result:=Path;
|
Result:=Path;
|
||||||
Len:=length(Result);
|
Len:=length(Result);
|
||||||
while (Len>1) and (Result[Len]=PathDelim) do dec(Len);
|
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
|
if Len<length(Result) then
|
||||||
SetLength(Result,Len);
|
SetLength(Result,Len);
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user