diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2007-04-05 13:32:02 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2007-04-05 13:32:02 +0000 |
commit | b409169d1dea71cb225778ca422a62012bc8b24f (patch) | |
tree | c631c9437dc410d206331c0cc5ebd3ccd4f451a1 | |
parent | ff38d3f529c04bfa4e53dfd3603f834fce7746d1 (diff) | |
download | mana-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-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/main.cpp | 14 |
2 files changed, 12 insertions, 9 deletions
@@ -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")); |