aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UPlatformWindows.pas
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/Classes/UPlatformWindows.pas')
-rw-r--r--Game/Code/Classes/UPlatformWindows.pas58
1 files changed, 58 insertions, 0 deletions
diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas
new file mode 100644
index 00000000..eb432335
--- /dev/null
+++ b/Game/Code/Classes/UPlatformWindows.pas
@@ -0,0 +1,58 @@
+unit UPlatformWindows;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+uses Classes, UPlatform;
+
+type
+
+ TPlatform = class(TInterfacedObject, IPlatform)
+ public
+ Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray;
+ end;
+
+implementation
+
+uses SysUtils, Windows;
+
+Function TPlatform.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray;
+var
+ i : Integer;
+ SR : TSearchRecW;
+begin
+ i := 0;
+ Filter := LowerCase(Filter);
+
+ if ReturnAllSubDirs then begin
+ if FindFirstW(Dir + '*', faDirectory, SR) = 0 then
+ repeat
+ if (SR.Name <> '.') and (SR.Name <> '..') then
+ begin
+ SetLength( Result, i + 1);
+ Result[i].Name := SR.Name;
+ Result[i].IsDirectory := true;
+ Result[i].IsFile := false;
+ i := i + 1;
+ end;
+ until FindNextW(SR) <> 0;
+ FindCloseW(SR);
+ end;
+
+ if FindFirstW(Dir + '*' + Filter, 0, SR) = 0 then
+ repeat
+ SetLength( Result, i + 1);
+ Result[i].Name := SR.Name;
+ Result[i].IsDirectory := true;
+ Result[i].IsFile := false;
+ i := i + 1;
+ until FindNextW(SR) <> 0;
+ FindCloseW(SR);
+end;
+
+end.