No using chdir for Mac OS 9 - it doesn't have it

This commit is contained in:
kreatordxx 2008-07-01 11:22:36 +00:00
parent e539cdc14b
commit ce914f552e
3 changed files with 14 additions and 8 deletions

View file

@ -5,6 +5,7 @@ D1X-Rebirth Changelog
arch/carbon/conf.h, D1X.make, d1x-Info.plist, d1xgl-Info.plist, d1x-rebirth.xcodeproj, English.lproj/InfoPlist.strings: Increment version number for Mac, update MPW makefile, ensure Get Info strings copy to bundle, use correct Mac OS X SDKs
include/strutil.h, misc/strutil.c: Add snprintf for Mac OS 9
main/songs.c: Make sure the right audio CD track is played when starting a level
include/physfsx.h, main/config.c: No using chdir for Mac OS 9 - it doesn't have it
20080617
--------

View file

@ -49,19 +49,20 @@ static inline void PHYSFSX_init(int argc, char *argv[])
#endif
#ifdef macintosh // Mac OS 9
char base_dir[PATH_MAX];
strcpy(base_dir, PHYSFS_getBaseDir());
if (strstr(base_dir, ".app:Contents:MacOSClassic:")) // the Mac OS 9 program is still in the .app bundle
strncat(base_dir, ":::", PATH_MAX - 1 - strlen(base_dir)); // go outside the .app bundle (the lazy way)
PHYSFS_setWriteDir(base_dir);
#else
#define base_dir PHYSFS_getBaseDir()
#endif
PHYSFS_init(argv[0]);
PHYSFS_permitSymbolicLinks(1);
#if (defined(__APPLE__) && defined(__MACH__)) || defined(macintosh) // others?
#ifdef macintosh
strcpy(base_dir, PHYSFS_getBaseDir());
if (strstr(base_dir, ".app:Contents:MacOSClassic:")) // the Mac OS 9 program is still in the .app bundle
strncat(base_dir, ":::", PATH_MAX - 1 - strlen(base_dir)); // go outside the .app bundle (the lazy way)
#endif
#if (defined(__APPLE__) && defined(__MACH__)) // others?
chdir(base_dir); // make sure relative hogdir and userdir paths work
#endif
@ -124,7 +125,7 @@ static inline void PHYSFSX_init(int argc, char *argv[])
{
PHYSFS_setWriteDir(base_dir);
if (!PHYSFS_getWriteDir())
Error("can't set write dir\n");
Error("can't set write dir: %s\n", PHYSFS_getLastError());
else
PHYSFS_addToSearchPath(PHYSFS_getWriteDir(), 0);
}

View file

@ -81,7 +81,11 @@ int ReadConfigFile()
GameCfg.VSync = 0;
GameCfg.Multisample = 0;
GameCfg.JukeboxOn = 0;
#ifndef macintosh // Mac OS 9 binary is in .app bundle
strncpy(GameCfg.JukeboxPath, "Jukebox", PATH_MAX+1); // maybe include this directory with the binary
#else
strncpy(GameCfg.JukeboxPath, "::::Jukebox", PATH_MAX+1);
#endif
memset(GameCfg.MplIpHostAddr, 0, 128);
infile = PHYSFSX_openReadBuffered("descent.cfg");