aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UPlatformMacOSX.pas
diff options
context:
space:
mode:
authoreddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-20 21:02:37 +0000
committereddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-20 21:02:37 +0000
commitce484ce148d1db51ddb3cda575786f0871843cb3 (patch)
tree16380707a09822ce266bc5a3e7c8427273289073 /Game/Code/Classes/UPlatformMacOSX.pas
parent34b0cb8bd025b40f52cff91bd9c29cd02faee7c2 (diff)
downloadusdx-ce484ce148d1db51ddb3cda575786f0871843cb3.tar.gz
usdx-ce484ce148d1db51ddb3cda575786f0871843cb3.tar.xz
usdx-ce484ce148d1db51ddb3cda575786f0871843cb3.zip
Changed Platform from Interface to Class.
Added TerminateIfAlreadyRunning and GetGamePath to UPlatform.pas. Fixed a bug in THookManager.Create ("SpacetoAllocate-1"). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@617 b956fd51-792f-4845-bead-9b4dfca2ff2c
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;