aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authoreddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-02 19:49:23 +0000
committereddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-02 19:49:23 +0000
commit2a1be1865f68633a2385d8e55a6bd815616ec23f (patch)
treef14198833206322c5f23104c4c98b6238d0fe737 /Game/Code/Classes
parent1107103fe87e01705094826991b205787ecc765f (diff)
downloadusdx-2a1be1865f68633a2385d8e55a6bd815616ec23f.tar.gz
usdx-2a1be1865f68633a2385d8e55a6bd815616ec23f.tar.xz
usdx-2a1be1865f68633a2385d8e55a6bd815616ec23f.zip
Fixed GamePath for Mac OS X.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@558 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r--Game/Code/Classes/UMain.pas24
1 files changed, 24 insertions, 0 deletions
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index e4acf4aa..1be4b463 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -1023,6 +1023,26 @@ begin
Player[PlayerNum].ScoreTotalI := 0;
end;
+{$IFDEF DARWIN}
+// Mac applications are packaged in directories.
+// We have to cut the last two directories
+// to get the application directory.
+Function GetGamePath : String;
+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;
+{$ENDIF}
+
//--------------------
// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist
//--------------------
@@ -1057,7 +1077,11 @@ procedure InitializePaths;
begin
+{$IFDEF DARWIN}
+ GamePath := GetGamePath;
+{$ELSE}
GamePath := ExtractFilePath(ParamStr(0));
+{$ENDIF}
initialize_path( LogPath , GamePath );
initialize_path( SoundPath , GamePath + 'Sounds' + PathDelim );