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 Bstrcmp strcmp
# define Bstrncmp strncmp
# if defined(_MSC_VER)
# if defined(_MSC_VER)
# define Bstrcasecmp _stricmp
# define Bstrncasecmp _strnicmp
# elif defined(__QNX__)
@ -761,7 +761,6 @@ char *Bgetenv(const char *name);
#endif
char *Bgethomedir(void);
char *Bgetsupportdir(void);
char *Bgetappdir(void);
uint32_t Bgetsysmemsize(void);
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);
char *osx_gethomedir(void);
char *osx_getsupportdir(void);
char *osx_getsupportdir(int32_t local);
char *osx_getappdir(void);
char *osx_getapplicationsdir(void);
char *osx_getapplicationsdir(int32_t local);
#ifdef __cplusplus
}

View file

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

View file

@ -73,15 +73,15 @@ char *osx_gethomedir(void)
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;
if ([paths count] > 0)
{
const char *Cpath = [[paths objectAtIndex:0] UTF8String];
if (Cpath)
returnpath = Bstrdup(Cpath);
}
@ -98,12 +98,12 @@ char *osx_getappdir(void)
CFStringRef str;
const char *s;
char *dir = NULL;
mainBundle = CFBundleGetMainBundle();
if (!mainBundle) {
return NULL;
}
resUrl = CFBundleCopyResourcesDirectoryURL(mainBundle);
CFRelease(mainBundle);
if (!resUrl) {
@ -120,25 +120,25 @@ char *osx_getappdir(void)
if (!str) {
return NULL;
}
s = CFStringGetCStringPtr(str, CFStringGetSystemEncoding());
if (s) {
dir = strdup(s);
}
CFRelease(str);
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;
if ([paths count] > 0)
{
const char *Cpath = [[paths objectAtIndex:0] UTF8String];
if (Cpath)
returnpath = Bstrdup(Cpath);
}

View file

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