From 1232c5103b88417350e586b8c5189fb6d8b20e27 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 22 Oct 2002 21:57:54 +0000 Subject: [PATCH] + Added some missing path functions --- rtl/objpas/fina.inc | 47 +++++++++++++++++++++++++++++++++++++++++++- rtl/objpas/finah.inc | 10 +++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/rtl/objpas/fina.inc b/rtl/objpas/fina.inc index d21d5aae37..85eb27e5d0 100644 --- a/rtl/objpas/fina.inc +++ b/rtl/objpas/fina.inc @@ -188,9 +188,54 @@ begin If Result>-1 then inc(Result); end; +function IncludeTrailingPathDelimiter(Const Path : String) : String; + +Var + l : Integer; + +begin + Result:=Path; + l:=Length(Result); + If (L=0) or (Result[l]<>PathDelim) then + Result:=Result+PathDelim; +end; + +function IncludeTrailingBackslash(Const Path : String) : String; + +begin + Result:=IncludeTrailingPathDelimiter(Path); +end; + +function ExcludeTrailingBackslash(Const Path: string): string; + +begin + Result:=ExcludeTrailingPathDelimiter(Path); +end; + +function ExcludeTrailingPathDelimiter(Const Path: string): string; + +Var + L : Integer; + +begin + L:=Length(Path); + If (L>0) and (Path[L]=PathDelim) then + Dec(L); + Result:=Copy(Path,1,L); +end; + +function IsPathDelimiter(Const Path: string; Index: Integer): Boolean; + +begin + Result:=(Index>0) and (Index<=Length(Path)) and (Path[Index]=PathDelim); +end; + { $Log$ - Revision 1.7 2002-10-12 15:34:09 michael + Revision 1.8 2002-10-22 21:57:54 michael + + Added some missing path functions + + Revision 1.7 2002/10/12 15:34:09 michael + Fixed changefileexit for long (>255) filenames Revision 1.6 2002/09/07 16:01:22 peter diff --git a/rtl/objpas/finah.inc b/rtl/objpas/finah.inc index da9ccb1acc..ffed171da7 100644 --- a/rtl/objpas/finah.inc +++ b/rtl/objpas/finah.inc @@ -34,13 +34,21 @@ function ExtractFileDir(Const FileName : string): string; function ExpandFileName (Const FileName : string): String; function ExpandUNCFileName (Const FileName : string): String; function ExtractRelativepath (Const BaseName,DestNAme : String): String; +function IncludeTrailingPathDelimiter(Const Path : String) : String; +function IncludeTrailingBackslash(Const Path : String) : String; +function ExcludeTrailingBackslash(Const Path: string): string; +function ExcludeTrailingPathDelimiter(Const Path: string): string; +function IsPathDelimiter(Const Path: string; Index: Integer): Boolean; Procedure DoDirSeparators (Var FileName : String); Function SetDirSeparators (Const FileName : String) : String; Function GetDirs (Var DirName : String; Var Dirs : Array of pchar) : Longint; { $Log$ - Revision 1.7 2002-09-07 16:01:22 peter + Revision 1.8 2002-10-22 21:57:54 michael + + Added some missing path functions + + Revision 1.7 2002/09/07 16:01:22 peter * old logs removed and tabs fixed }