Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi IncludeTrailingBackslash -> Copy (ReadDir) (https://www.delphipraxis.net/113894-includetrailingbackslash-copy-readdir.html)

Real-TTX 16. Mai 2008 12:17


IncludeTrailingBackslash -> Copy (ReadDir)
 
Huhu Gemeinde :)

Ich versuche ein Verzeichnis Einzulesen. Habe dann auch eine Funktion gefunden im Netz, die ich auch verwenden wollte. Das Problem dabei ist, dass die Funktion "IncludeTrailingBackslash" benutzt. Und mein Compiler sagt mir da: "Warning: Systemabhängige Funktion".

Dies wollte ich umgehen, indem ich die Funktion durch ein Copy Befehl ersetze. Aber leider ohne Erfolg.

Ich hoffe jemand weis genaueres. Hier ist die Funktion mit den beiden Varianten:

Delphi-Quellcode:
function ReadDir(Path, Mask: string; ShowPath: boolean): TStringlist;
var
  SRec: TSearchRec;
  tmp: string;
begin
  // Variante 1
  tmp := Copy(Path, (length(Path)-1) , length(Path));
  if (not(tmp = '\')) then
  begin
    Path := Path + '\';
  end;

  // Variante 2
  //Path := IncludeTrailingBackslash(Path);

  result := TStringList.Create;
  try
    if FindFirst(Path + Mask, not faDirectory, SRec) <> 0 then exit;
    repeat
      case ShowPath of
        True : result.Add(Path + SRec.Name);
        False : result.Add(SRec.Name);
      end;
    until FindNext(SRec) <> 0;
  finally
    FindClose(SRec);
  end;
end;
Danke im Vorraus....

Gruß, Real-TTX

Muetze1 16. Mai 2008 12:20

Re: IncludeTrailingBackslash -> Copy (ReadDir)
 
Ein Blick in die Hilfe hätte dir gezeigt, dass die Funktion durch Delphi-Referenz durchsuchenIncludeTrailingPathDelimiter() ersetzt wurde.

Real-TTX 16. Mai 2008 12:29

Re: IncludeTrailingBackslash -> Copy (ReadDir)
 
Danke Vielmals für die schnelle Antwort und Kompetente Lösung.

Das ist mir nun echt peinlich :/ Hätte das unnötige Forum Thema auch sparen können....

Trotzdem, Vielen Dank

Muetze1 16. Mai 2008 12:30

Re: IncludeTrailingBackslash -> Copy (ReadDir)
 
Kein Problem, so findets der nächste...


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:49 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz