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 /src | |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
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")); |