summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-30 20:34:58 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-30 20:34:58 +0200
commitea19cc001837b5ab4625d0c7f100b445e396eaad (patch)
tree5d0b404bfe542dff497470e1494b8d8027fad5bb
parentbb0257f9318c099a3ed5c061710e448e68517a96 (diff)
downloadmana-ea19cc001837b5ab4625d0c7f100b445e396eaad.tar.gz
mana-ea19cc001837b5ab4625d0c7f100b445e396eaad.tar.bz2
mana-ea19cc001837b5ab4625d0c7f100b445e396eaad.tar.xz
mana-ea19cc001837b5ab4625d0c7f100b445e396eaad.zip
Fixed the --home-dir command line option on MacOS X
-rw-r--r--src/main.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a2db380c..16cbbdfe 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -313,25 +313,24 @@ static void setUpdatesDir()
static void initHomeDir(const Options &options)
{
homeDir = options.homeDir;
-
+
if (homeDir.empty())
{
- homeDir = std::string(PHYSFS_getUserDir()) +
- "/." +
- branding.getValue("appShort", "tmw");
+#ifdef __APPLE__
+ // Use Application Directory instead of .tmw
+ homeDir = std::string(PHYSFS_getUserDir()) +
+ "/Library/Application Support/" +
+ branding.getValue("appName", "The Mana World");
+#else
+ homeDir = std::string(PHYSFS_getUserDir()) +
+ "/." + branding.getValue("appShort", "tmw");
+#endif
}
#if defined WIN32
if (!CreateDirectory(homeDir.c_str(), 0) &&
GetLastError() != ERROR_ALREADY_EXISTS)
-#elif defined __APPLE__
- // Use Application Directory instead of .tmw
- homeDir = std::string(PHYSFS_getUserDir()) +
- "/Library/Application Support/" +
- branding.getValue("appName", "The Mana World");
- if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
- (errno != EEXIST))
#else
- // Checking if /home/user/.tmw folder exists.
+ // Create home directory if it doesn't exist already
if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
(errno != EEXIST))
#endif