diff options
Diffstat (limited to 'Game/Code/Classes/UPlatform.pas')
-rw-r--r-- | Game/Code/Classes/UPlatform.pas | 63 |
1 files changed, 48 insertions, 15 deletions
diff --git a/Game/Code/Classes/UPlatform.pas b/Game/Code/Classes/UPlatform.pas index a06914d0..bdd6cf78 100644 --- a/Game/Code/Classes/UPlatform.pas +++ b/Game/Code/Classes/UPlatform.pas @@ -25,7 +25,17 @@ type TDirectoryEntryArray = Array of TDirectoryEntry; - TPlatform = class + IPlatform = Interface + ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCA23DF}'] + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; + + function GetLogPath : WideString; + function GetGameSharedPath : WideString; + function GetGameUserPath : WideString; + end; + + TPlatform = class( TInterfacedOBject, IPlatform ) // 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 @@ -34,11 +44,16 @@ type function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; virtual; - function GetGamePath : WideString; virtual; +// function GetGamePath : WideString; virtual; + function GetLogPath : WideString; virtual; + function GetGameSharedPath : WideString; virtual; + function GetGameUserPath : WideString; virtual; + end; + var - Platform : TPlatform; + Platform : IPlatform; implementation @@ -55,19 +70,37 @@ uses {$ENDIF} { TPlatform } -
+ +(* function TPlatform.GetGamePath: WideString; -begin
- // Windows and Linux use this:
- Result := ExtractFilePath(ParamStr(0));
-end;
-
+begin + // Windows and Linux use this: + Result := ExtractFilePath(ParamStr(0)); +end; +*) +function TPlatform.GetLogPath : WideString; +begin + result := ExtractFilePath(ParamStr(0)); +end; + +function TPlatform.GetGameSharedPath : WideString; +begin + result := ExtractFilePath(ParamStr(0)); +end; + +function TPlatform.GetGameUserPath : WideString; +begin + result := ExtractFilePath(ParamStr(0)); +end; + + + function TPlatform.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; -begin
- // Linux and Mac don't check for running apps at the moment
- Result := false;
-end;
-
+begin + // Linux and Mac don't check for running apps at the moment + Result := false; +end; + initialization {$IFDEF MSWINDOWS} @@ -81,5 +114,5 @@ initialization {$ENDIF} finalization - freeandnil( Platform ); + Platform := nil; end. |