- Fixed: m_specialpaths.cpp did not compile under Linux.

This commit is contained in:
Randy Heit 2013-09-18 17:29:42 -05:00
parent 8ef130c376
commit e748c49dd0
2 changed files with 21 additions and 16 deletions

View file

@ -12,9 +12,16 @@
#include "cmdlib.h" #include "cmdlib.h"
#include "m_misc.h" #include "m_misc.h"
#if defined(_WIN32) #if !defined(__APPLE__) && !defined(_WIN32)
#include <sys/stat.h>
#include <sys/types.h>
#include "i_system.h"
#endif
#include "version.h" // for GAMENAME #include "version.h" // for GAMENAME
#if defined(_WIN32)
typedef HRESULT (WINAPI *GKFP)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *); typedef HRESULT (WINAPI *GKFP)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *);
//=========================================================================== //===========================================================================
@ -195,7 +202,7 @@ FString M_GetConfigPath(bool for_reading)
// Construct a user-specific config name // Construct a user-specific config name
if (UseKnownFolders() && GetKnownFolder(CSIDL_APPDATA, FOLDERID_RoamingAppData, true, path)) if (UseKnownFolders() && GetKnownFolder(CSIDL_APPDATA, FOLDERID_RoamingAppData, true, path))
{ {
path << '/' << GAME_DIR; path += "/" GAME_DIR;
CreatePath(path); CreatePath(path);
path += "/zdoom.ini"; path += "/zdoom.ini";
} }
@ -534,7 +541,7 @@ FString M_GetCachePath(bool create)
FString path = NicePath("~/.config/zdoom/cache"); FString path = NicePath("~/.config/zdoom/cache");
if (create) if (create)
{ {
CreatePath(create); CreatePath(path);
} }
return path; return path;
} }
@ -564,16 +571,16 @@ FString M_GetCajunPath(const char *botfilename)
{ {
FString path; FString path;
// Check first in ~/.config/zdoom./botfilename. // Check first in ~/.config/zdoom/botfilename.
path = GetUserFile(BOTFILENAME); path = GetUserFile(botfilename);
if (!FileExists(tmp)) if (!FileExists(path))
{ {
// Then check in SHARE_DIR/botfilename. (Some allowance for Macs // Then check in SHARE_DIR/botfilename.
// should probably be made here.) path = SHARE_DIR;
path = SHARE_DIR BOTFILENAME; path << botfilename;
if (!FileExists(path)) if (!FileExists(path))
{ {
path =""; path = "";
} }
} }
return path; return path;
@ -604,7 +611,7 @@ FString M_GetConfigPath(bool for_reading)
FString M_GetScreenshotsPath() FString M_GetScreenshotsPath()
{ {
return "~/" GAME_DIR "/screenshots/"; return NicePath("~/" GAME_DIR "/screenshots/");
} }
//=========================================================================== //===========================================================================
@ -617,7 +624,7 @@ FString M_GetScreenshotsPath()
FString M_GetSavegamesPath() FString M_GetSavegamesPath()
{ {
return = "~/" GAME_DIR; return NicePath("~/" GAME_DIR);
} }
#endif #endif

View file

@ -91,12 +91,10 @@ const char *GetVersionString();
#define FORUM_URL "http://forum.zdoom.org" #define FORUM_URL "http://forum.zdoom.org"
#define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3" #define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3"
#ifdef __unix__ #if defined(__APPLE__) || defined(_WIN32)
#define GAME_DIR ".config/zdoom"
#elif defined(__APPLE__)
#define GAME_DIR GAMENAME #define GAME_DIR GAMENAME
#else #else
#define GAME_DIR "zdoom" #define GAME_DIR ".config/zdoom"
#endif #endif