aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UPlatformMacOSX.pas
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UPlatformMacOSX.pas26
1 files changed, 23 insertions, 3 deletions
diff --git a/Game/Code/Classes/UPlatformMacOSX.pas b/Game/Code/Classes/UPlatformMacOSX.pas
index 56469299..4e0c9061 100644
--- a/Game/Code/Classes/UPlatformMacOSX.pas
+++ b/Game/Code/Classes/UPlatformMacOSX.pas
@@ -12,16 +12,36 @@ uses Classes, UPlatform;
type
- TPlatform = class(TInterfacedObject, IPlatform)
+ TPlatformMacOSX = class(TPlatform)
+ private
public
- Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray;
+ Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override;
+ function GetGamePath: WideString; override;
end;
implementation
uses SysUtils, baseunix;
-Function TPlatform.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray;
+// Mac applications are packaged in directories.
+// We have to cut the last two directories
+// to get the application directory.
+Function TPlatformMacOSX.GetGamePath : WideString;
+var
+ x,
+ i : integer;
+begin
+ Result := ExtractFilePath(ParamStr(0));
+ for x := 0 to 2 do begin
+ i := Length(Result);
+ repeat
+ Delete( Result, i, 1);
+ i := Length(Result);
+ until (i = 0) or (Result[i] = '/');
+ end;
+end;
+
+Function TPlatformMacOSX.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray;
var
i : Integer;
TheDir : pdir;