1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-31 00:07:39 +02:00
This commit is contained in:
Michał W. Urbańczyk
2013-02-04 23:12:43 +00:00
parent a9d458c8f4
commit 59abcac7da
2 changed files with 30 additions and 3 deletions

View File

@@ -17,7 +17,6 @@
using namespace boost::filesystem;
#endif
/// Where to find the various VCMI files. This is mostly useful for linux.
class VCMIDirs {
public:
@@ -31,10 +30,21 @@ public:
try {
#ifdef ANDROID
UserPath = DATA_DIR;
#elif defined(__APPLE__)
// This is Cocoa code that should be normally used to get path to Application Support folder but can't use it here for now...
// NSArray* urls = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask];
// UserPath = path([urls[0] path] + "/vcmi").string();
// ...so here goes a bit of hardcode instead
std::string home_dir = ".";
if (getenv("HOME") != NULL )
home_dir = getenv("HOME");
UserPath = path(home_dir + "/Library/Application Support/vcmi").string();
#else
// Find vcmi user directory and create it if necessary
std::string home_dir = ".";
if( getenv("HOME") != NULL )
if (getenv("HOME") != NULL )
home_dir = getenv("HOME");
UserPath = path(home_dir + "/.vcmi").string();