summaryrefslogtreecommitdiff
path: root/pkg/osx/Execute.m
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/osx/Execute.m')
-rw-r--r--pkg/osx/Execute.m11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/osx/Execute.m b/pkg/osx/Execute.m
index bb4eed45..608443e2 100644
--- a/pkg/osx/Execute.m
+++ b/pkg/osx/Execute.m
@@ -100,6 +100,7 @@ static void DoExec(const char *executable, const char *iwad, const char *args)
void ExecuteProgram(const char *executable, const char *iwad, const char *args)
{
pid_t childpid;
+ char *homedir;
childpid = fork();
@@ -107,6 +108,16 @@ void ExecuteProgram(const char *executable, const char *iwad, const char *args)
{
signal(SIGCHLD, SIG_DFL);
+ // Change directory to home dir before launch, so that any demos
+ // are saved somewhere sensible.
+
+ homedir = getenv("HOME");
+
+ if (homedir != NULL)
+ {
+ chdir(homedir);
+ }
+
DoExec(executable, iwad, args);
}
else