Mapster32 user_profiles_enabled fix

git-svn-id: https://svn.eduke32.com/eduke32@1003 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-08-23 03:12:23 +00:00
parent dcc6d730a6
commit 6829e5f403
3 changed files with 30 additions and 5 deletions

View file

@ -339,11 +339,29 @@ char *Bgethomedir(void)
#ifdef _WIN32
FARPROC aSHGetSpecialFolderPathA;
TCHAR appdata[MAX_PATH];
int loaded = 0;
HMODULE hShell32 = GetModuleHandle("shell32.dll");
aSHGetSpecialFolderPathA = GetProcAddress(GetModuleHandle("shell32.dll"), "SHGetSpecialFolderPathA");
if (hShell32 == NULL)
{
hShell32 = LoadLibrary("shell32.dll");
loaded = 1;
}
if (hShell32 == NULL)
return NULL;
aSHGetSpecialFolderPathA = GetProcAddress(hShell32, "SHGetSpecialFolderPathA");
if (aSHGetSpecialFolderPathA != NULL)
if (SUCCEEDED(aSHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE)))
{
if (loaded)
FreeLibrary(hShell32);
return strdup(appdata);
}
if (loaded)
FreeLibrary(hShell32);
return NULL;
#elif defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3
FSRef ref;

View file

@ -7427,7 +7427,15 @@ int ExtInit(void)
addsearchpath("/Library/Application Support/EDuke32");
#endif
if (getcwd(cwd,BMAX_PATH)) addsearchpath(cwd);
if (getcwd(cwd,BMAX_PATH)) {
#if defined(__APPLE__)
/* Dirty hack on OS X to also look for gamedata inside the application bundle - rhoenie 08/08 */
char seekinappcontainer[BMAX_PATH];
Bsnprintf(seekinappcontainer,sizeof(seekinappcontainer),"%s/EDuke32.app/", cwd);
addsearchpath(seekinappcontainer);
#endif
addsearchpath(cwd);
}
if (CommandPaths)
{
@ -7449,7 +7457,6 @@ int ExtInit(void)
if (usecwd == 0 && access("user_profiles_disabled", F_OK))
#endif
{
char cwd[BMAX_PATH];
char *homedir;
int asperr;

View file

@ -50,7 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <windows.h>
#include <shellapi.h>
extern int getversionfromwebsite(char *buffer);
#define BUILDDATE 20080821 // this is checked against http://eduke32.com/VERSION
#define BUILDDATE 20080822 // this is checked against http://eduke32.com/VERSION
#define UPDATEINTERVAL 604800 // 1w
#else
static int usecwd = 0;
@ -10643,7 +10643,7 @@ void app_main(int argc,const char **argv)
if (Bmkdir(cwd,S_IRWXU) == 0) asperr = addsearchpath(cwd);
else asperr = -1;
}
if ((asperr == 0))
if (asperr == 0)
chdir(cwd);
Bfree(homedir);
}