Einzelnen Beitrag anzeigen

Glados
(Gast)

n/a Beiträge
 
#13

AW: Eine Pfadangabe "säubern"?

  Alt 12. Sep 2017, 07:53
Das ist gut zu wissen. Ich sollte dem Windows-Explorer weniger Beachtung schenken.

Dann kann das hier ja schon einmal raus
Delphi-Quellcode:
while Pos('\ ', aPath) > 0 do
 aPath := StringReplace(aPath, '\ ', '\', [rfReplaceAll]);
Auch geändert habe ich das hier
Delphi-Quellcode:
 // bIsNetworkPath := Copy(aPath, 1, 2) = '\\';
 bIsNetworkPath := IsUNCPathEx(aPath);
Delphi-Quellcode:
// (teils aus der DP-Suche)

function IsUNCPathEx(aPath: string): Boolean;
begin
 // true: aPath = \\server\path, \\?\server\path or \\?\UNC\server\path
 Result := GetUNCPrefix(aPath) <> '';
end;

function GetUNCPrefix(aPath: string): string;
begin
 Result := '';

 case GetExtendedPrefix(aPath) of
  pptExtended:
   Result := '\\?\';
  pptExtendedUNC:
   Result := '\\?\UNC\'
 else
  if Copy(aPath, 1, 2) = '\\then
   Result := '\\';
 end;
end;
  Mit Zitat antworten Zitat