Refine the previous commit a bit. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4802 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-12-08 07:32:58 +00:00
parent 0b91499ee0
commit 735525758d
5 changed files with 40 additions and 40 deletions

View file

@ -651,7 +651,7 @@ FORCE_INLINE uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7fff
# define Bstrncpy strncpy # define Bstrncpy strncpy
# define Bstrcmp strcmp # define Bstrcmp strcmp
# define Bstrncmp strncmp # define Bstrncmp strncmp
# if defined(_MSC_VER) # if defined(_MSC_VER)
# define Bstrcasecmp _stricmp # define Bstrcasecmp _stricmp
# define Bstrncasecmp _strnicmp # define Bstrncasecmp _strnicmp
# elif defined(__QNX__) # elif defined(__QNX__)
@ -761,7 +761,6 @@ char *Bgetenv(const char *name);
#endif #endif
char *Bgethomedir(void); char *Bgethomedir(void);
char *Bgetsupportdir(void);
char *Bgetappdir(void); char *Bgetappdir(void);
uint32_t Bgetsysmemsize(void); uint32_t Bgetsysmemsize(void);
int32_t Bcorrectfilename(char *filename, int32_t removefn); int32_t Bcorrectfilename(char *filename, int32_t removefn);

View file

@ -10,9 +10,9 @@ int32_t osx_msgbox(const char *name, const char *msg);
int32_t osx_ynbox(const char *name, const char *msg); int32_t osx_ynbox(const char *name, const char *msg);
char *osx_gethomedir(void); char *osx_gethomedir(void);
char *osx_getsupportdir(void); char *osx_getsupportdir(int32_t local);
char *osx_getappdir(void); char *osx_getappdir(void);
char *osx_getapplicationsdir(void); char *osx_getapplicationsdir(int32_t local);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -419,22 +419,13 @@ char *Bgethomedir(void)
#endif #endif
} }
char *Bgetsupportdir(void)
{
#if defined __APPLE__
return osx_getsupportdir();
#else
return Bgethomedir();
#endif
}
char *Bgetappdir(void) char *Bgetappdir(void)
{ {
char *dir = NULL; char *dir = NULL;
#ifdef _WIN32 #ifdef _WIN32
TCHAR appdir[MAX_PATH]; TCHAR appdir[MAX_PATH];
if (GetModuleFileName(NULL, appdir, MAX_PATH) > 0) { if (GetModuleFileName(NULL, appdir, MAX_PATH) > 0) {
// trim off the filename // trim off the filename
char *slash = strrchr(appdir, '\\'); char *slash = strrchr(appdir, '\\');
@ -472,7 +463,7 @@ char *Bgetappdir(void)
dir = strdup(dirname(buf)); dir = strdup(dirname(buf));
} }
#endif #endif
return dir; return dir;
} }

View file

@ -73,15 +73,15 @@ char *osx_gethomedir(void)
return returnpath; return returnpath;
} }
char *osx_getsupportdir(void) char *osx_getsupportdir(int32_t local)
{ {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, local ? NSUserDomainMask : NSLocalDomainMask, YES);
char *returnpath = NULL; char *returnpath = NULL;
if ([paths count] > 0) if ([paths count] > 0)
{ {
const char *Cpath = [[paths objectAtIndex:0] UTF8String]; const char *Cpath = [[paths objectAtIndex:0] UTF8String];
if (Cpath) if (Cpath)
returnpath = Bstrdup(Cpath); returnpath = Bstrdup(Cpath);
} }
@ -98,12 +98,12 @@ char *osx_getappdir(void)
CFStringRef str; CFStringRef str;
const char *s; const char *s;
char *dir = NULL; char *dir = NULL;
mainBundle = CFBundleGetMainBundle(); mainBundle = CFBundleGetMainBundle();
if (!mainBundle) { if (!mainBundle) {
return NULL; return NULL;
} }
resUrl = CFBundleCopyResourcesDirectoryURL(mainBundle); resUrl = CFBundleCopyResourcesDirectoryURL(mainBundle);
CFRelease(mainBundle); CFRelease(mainBundle);
if (!resUrl) { if (!resUrl) {
@ -120,25 +120,25 @@ char *osx_getappdir(void)
if (!str) { if (!str) {
return NULL; return NULL;
} }
s = CFStringGetCStringPtr(str, CFStringGetSystemEncoding()); s = CFStringGetCStringPtr(str, CFStringGetSystemEncoding());
if (s) { if (s) {
dir = strdup(s); dir = strdup(s);
} }
CFRelease(str); CFRelease(str);
return dir; return dir;
} }
char *osx_getapplicationsdir(void) char *osx_getapplicationsdir(int32_t local)
{ {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSAllApplicationsDirectory, NSLocalDomainMask, YES); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSAllApplicationsDirectory, local ? NSUserDomainMask : NSLocalDomainMask, YES);
char *returnpath = NULL; char *returnpath = NULL;
if ([paths count] > 0) if ([paths count] > 0)
{ {
const char *Cpath = [[paths objectAtIndex:0] UTF8String]; const char *Cpath = [[paths objectAtIndex:0] UTF8String];
if (Cpath) if (Cpath)
returnpath = Bstrdup(Cpath); returnpath = Bstrdup(Cpath);
} }

View file

@ -801,25 +801,35 @@ void G_AddSearchPaths(void)
addsearchpath("/usr/local/share/games/eduke32"); addsearchpath("/usr/local/share/games/eduke32");
#elif defined(__APPLE__) #elif defined(__APPLE__)
char buf[BMAX_PATH]; char buf[BMAX_PATH];
char *applications = osx_getapplicationsdir(); int32_t i;
char *support = Bgetsupportdir(); char *applications[] = { osx_getapplicationsdir(0), osx_getapplicationsdir(1) };
char *support[] = { osx_getsupportdir(0), osx_getsupportdir(1) };
Bsnprintf(buf, sizeof(buf), "%s/Steam", support); for (i = 0; i < 2; i++)
G_AddSteamPathsApple(buf); {
Bsnprintf(buf, sizeof(buf), "%s/Steam", support[i]);
G_AddSteamPathsApple(buf);
Bsnprintf(buf, sizeof(buf), "%s/Steam/steamapps/libraryfolders.vdf", support); Bsnprintf(buf, sizeof(buf), "%s/Steam/steamapps/libraryfolders.vdf", support[i]);
G_ParseSteamKeyValuesForPaths(buf); G_ParseSteamKeyValuesForPaths(buf);
Bsnprintf(buf, sizeof(buf), "%s/Duke Nukem 3D.app/Contents/Resources/Duke Nukem 3D.boxer/C.harddisk", applications); Bsnprintf(buf, sizeof(buf), "%s/Duke Nukem 3D.app/Contents/Resources/Duke Nukem 3D.boxer/C.harddisk", applications[i]);
addsearchpath(buf); addsearchpath(buf);
}
Bsnprintf(buf, sizeof(buf), "%s/JFDuke3D", support); for (i = 0; i < 2; i++)
addsearchpath(buf); {
Bsnprintf(buf, sizeof(buf), "%s/EDuke32", support); Bsnprintf(buf, sizeof(buf), "%s/JFDuke3D", support[i]);
addsearchpath(buf); addsearchpath(buf);
Bsnprintf(buf, sizeof(buf), "%s/EDuke32", support[i]);
addsearchpath(buf);
}
Bfree(applications); for (i = 0; i < 2; i++)
Bfree(support); {
Bfree(applications[i]);
Bfree(support[i]);
}
#elif defined (_WIN32) #elif defined (_WIN32)
char buf[BMAX_PATH]; char buf[BMAX_PATH];
const char* instpath; const char* instpath;