summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2007-04-05 13:32:02 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2007-04-05 13:32:02 +0000
commitb409169d1dea71cb225778ca422a62012bc8b24f (patch)
treec631c9437dc410d206331c0cc5ebd3ccd4f451a1
parentff38d3f529c04bfa4e53dfd3603f834fce7746d1 (diff)
downloadmana-b409169d1dea71cb225778ca422a62012bc8b24f.tar.gz
mana-b409169d1dea71cb225778ca422a62012bc8b24f.tar.bz2
mana-b409169d1dea71cb225778ca422a62012bc8b24f.tar.xz
mana-b409169d1dea71cb225778ca422a62012bc8b24f.zip
Unified storage of configuration, updates and screenshots in home directory.
-rw-r--r--ChangeLog7
-rw-r--r--src/main.cpp14
2 files changed, 12 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index d8aa6726..29bf11a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2007-04-03 Philipp Sehmisch <tmw@crushnet.org>
+2007-04-05 Eugenio Favalli <elvenprogrammer@gmail.com>
+
+ * src/main.cpp: Unified storage of configuration, updates and
+ screenshots in home directory.
+
+2007-04-03 Philipp Sehmisch <tmw@crushnet.org>
* data/graphics/items/generic-easteregg-blue.png,
data/graphics/items/generic-easteregg-green.png,
diff --git a/src/main.cpp b/src/main.cpp
index 71963786..1b936e19 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -135,23 +135,21 @@ struct Options
*/
void init_engine(const Options &options)
{
- std::string homeDir = "";
-#if !(defined __USE_UNIX98 || defined __FreeBSD__ || defined __APPLE__)
- // In Windows and other systems we currently store data next to executable.
- homeDir = ".";
+ std::string homeDir = std::string(PHYSFS_getUserDir()) + "/.tmw";
+#if defined WIN32
+ if (!CreateDirectory(homeDir.c_str(), 0) &&
+ GetLastError() != ERROR_ALREADY_EXISTS)
#else
- homeDir = std::string(PHYSFS_getUserDir()) + "/.tmw";
-
// Checking if /home/user/.tmw folder exists.
if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
(errno != EEXIST))
+#endif
{
std::cout << homeDir
- << " can't be made, but it doesn't exist! Exiting."
+ << " can't be created, but it doesn't exist! Exiting."
<< std::endl;
exit(1);
}
-#endif
// Set log file
logger->setLogFile(homeDir + std::string("/tmw.log"));