aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code')
-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 );