aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UPlatform.pas
blob: cc971bed368c90ca9b06e677d7df24711bea0376 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
unit UPlatform;

// Comment by Eddie:
// This unit defines an interface for platform specific utility functions.
// The Interface is implemented in separate files for each platform:
// UPlatformWindows, UPlatformLinux and UPlatformWindows.

interface

{$IFDEF FPC}
  {$MODE Delphi}
{$ENDIF}

{$I switches.inc}

uses Classes;

type
  
  TDirectoryEntry = Record
    Name : WideString;
	IsDirectory : Boolean;
	IsFile : Boolean;
  end;
 
  TDirectoryEntryArray = Array of TDirectoryEntry;
	
  IPlatform = interface
  
	// DirectoryFindFiles returns all files matching the filter. Do not use '*' in the filter.
	// If you set ReturnAllSubDirs = true all directories will be returned, if yout set it to false
	// directories are completely ignored. 
    Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; 
  end;

var
  Platform : IPlatform;

implementation

uses
  {$IFDEF MSWINDOWS}
  UPlatformWindows;
  {$ENDIF}
  {$IFDEF LINUX}
  UPlatformLinux;
  {$ENDIF}
  {$IFDEF DARWIN}
  UPlatformMacOSX;
  {$ENDIF}

initialization

  Platform := TPlatform.Create;

end.