diff options
author | Simon Howard | 2010-01-30 16:14:04 +0000 |
---|---|---|
committer | Simon Howard | 2010-01-30 16:14:04 +0000 |
commit | fdcd8dda0935403185ba307304028d3a682297a9 (patch) | |
tree | ea7bb9c04d34c79ad0c394495f08cd4064a38c12 /pkg | |
parent | a054475997a14499a9bce528a64efb22ce2fe2b0 (diff) | |
download | chocolate-doom-fdcd8dda0935403185ba307304028d3a682297a9.tar.gz chocolate-doom-fdcd8dda0935403185ba307304028d3a682297a9.tar.bz2 chocolate-doom-fdcd8dda0935403185ba307304028d3a682297a9.zip |
Change directory to home directory before launching the game, so that
recorded demos go somewhere sensible.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1835
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/osx/Execute.m | 11 |
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 |