diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-23 15:03:54 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-23 15:03:54 +0000 |
commit | 54d99d9a8a00deef299dbc9fb34a06e4ca6bfe42 (patch) | |
tree | 030ba46054e7b42cdf1646eeff8b7b3213ad7565 | |
parent | 6e563f3fafe4e741370701adf19b1ee9eccafbeb (diff) | |
download | usdx-54d99d9a8a00deef299dbc9fb34a06e4ca6bfe42.tar.gz usdx-54d99d9a8a00deef299dbc9fb34a06e4ca6bfe42.tar.xz usdx-54d99d9a8a00deef299dbc9fb34a06e4ca6bfe42.zip |
DirectoryFindFiles unified for mac+unix
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1862 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r-- | unicode/src/base/UCommon.pas | 1 | ||||
-rw-r--r-- | unicode/src/base/UPlatformLinux.pas | 9 | ||||
-rw-r--r-- | unicode/src/base/UPlatformMacOSX.pas | 11 |
3 files changed, 12 insertions, 9 deletions
diff --git a/unicode/src/base/UCommon.pas b/unicode/src/base/UCommon.pas index 3230a065..d7c36196 100644 --- a/unicode/src/base/UCommon.pas +++ b/unicode/src/base/UCommon.pas @@ -225,6 +225,7 @@ end; {$ENDIF} +{ TODO: REMOVE } // Checks if a regular files or directory with the given name exists. // The comparison is case insensitive. function FileExistsInsensitive(var FileName: string): boolean; diff --git a/unicode/src/base/UPlatformLinux.pas b/unicode/src/base/UPlatformLinux.pas index 30499a97..7efeb963 100644 --- a/unicode/src/base/UPlatformLinux.pas +++ b/unicode/src/base/UPlatformLinux.pas @@ -102,24 +102,23 @@ var i: Integer; TheDir : pDir; ADirent : pDirent; - Entry : Longint; lAttrib : integer; begin i := 0; Filter := LowerCase(Filter); - TheDir := FpOpenDir( Dir ); + TheDir := FpOpenDir(Dir); if Assigned(TheDir) then begin repeat - ADirent := FpReadDir(TheDir^); + ADirent := FpReadDir(TheDir^); if Assigned(ADirent) and (ADirent^.d_name <> '.') and (ADirent^.d_name <> '..') then begin lAttrib := FileGetAttr(Dir + ADirent^.d_name); if ReturnAllSubDirs and ((lAttrib and faDirectory) <> 0) then begin - SetLength( Result, i + 1); + SetLength(Result, i + 1); Result[i].Name := ADirent^.d_name; Result[i].IsDirectory := true; Result[i].IsFile := false; @@ -127,7 +126,7 @@ begin end else if (Length(Filter) = 0) or (Pos( Filter, LowerCase(ADirent^.d_name)) > 0) then begin - SetLength( Result, i + 1); + SetLength(Result, i + 1); Result[i].Name := ADirent^.d_name; Result[i].IsDirectory := false; Result[i].IsFile := true; diff --git a/unicode/src/base/UPlatformMacOSX.pas b/unicode/src/base/UPlatformMacOSX.pas index 96e4bc63..08ad247d 100644 --- a/unicode/src/base/UPlatformMacOSX.pas +++ b/unicode/src/base/UPlatformMacOSX.pas @@ -288,6 +288,7 @@ begin Result := GetApplicationSupportPath; end; +{ TODO: REMOVE } function TPlatformMacOSX.DirectoryFindFiles(Dir, Filter: WideString; ReturnAllSubDirs: boolean): TDirectoryEntryArray; var i : integer; @@ -298,10 +299,11 @@ begin i := 0; Filter := LowerCase(Filter); - TheDir := FPOpenDir(Dir); + TheDir := FpOpenDir(Dir); if Assigned(TheDir) then + begin repeat - ADirent := FPReadDir(TheDir); + ADirent := FpReadDir(TheDir^); if Assigned(ADirent) and (ADirent^.d_name <> '.') and (ADirent^.d_name <> '..') then begin @@ -323,9 +325,10 @@ begin i := i + 1; end; end; - until ADirent = nil; + until (ADirent = nil); - FPCloseDir(TheDir); + FpCloseDir(TheDir^); + end; end; end. |