Einzelnen Beitrag anzeigen

Gruber_Hans_12345

Registriert seit: 14. Aug 2004
1.426 Beiträge
 
Delphi 2007 Professional
 
#6

Re: Prüfen ob relativer oder absoluter Pfad

  Alt 2. Apr 2005, 11:03
Zitat von alcaeus:
Da kann ich mit einem Vierzeiler dagegenhalten:

Delphi-Quellcode:
function IsRelativePath(Path: String): Boolean;
begin
  Result := (Path[2] <> ':') and (Copy(Path, 1, 2) <> '\\');
end;
Die Funktion kommt auch mit Verzeichnissen wie
Code:
\\PC-Name\Freigabe
klar, denn das waere auch ein absoluter Pfad.

Greetz
alcaeus
... und bei einem Path von nur einem Zeihen dann eine AV

Delphi-Quellcode:
function IsRelativePath(Path: String): Boolean;
begin
  Result := (Copy(Path, 2, 1) <> ':') and (Copy(Path, 1, 2) <> '\\');
end;
Gruss Hans

2B or not 2B, that is FF
  Mit Zitat antworten Zitat