summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-07-28 17:51:41 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-07-28 17:51:41 +0000
commit81caf032f4f0c852c57eb95a2d049cc8ec964c44 (patch)
tree6d4dcf07864835873a7bc17f0a1ad66b765d1b11
parent3fe829466ac7a0cd97d139c0b691813b99bddc12 (diff)
downloadmana-client-81caf032f4f0c852c57eb95a2d049cc8ec964c44.tar.gz
mana-client-81caf032f4f0c852c57eb95a2d049cc8ec964c44.tar.bz2
mana-client-81caf032f4f0c852c57eb95a2d049cc8ec964c44.tar.xz
mana-client-81caf032f4f0c852c57eb95a2d049cc8ec964c44.zip
Fixed updates directory not being created on non-unix systems.
-rw-r--r--ChangeLog2
-rw-r--r--src/main.cpp18
2 files changed, 12 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index dbc057c3..3ef8ae12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,8 @@
Being class and removed the old #define's.
* src/resources/resourcemanager.cpp: Fixed a location where a wrong
dir-separator was used.
+ * src/main.cpp: Fixed updates directory not being created on non-unix
+ systems. Started using PhysFS write support.
2005-07-27 Bjørn Lindeijer <bjorn@lindeijer.nl>
diff --git a/src/main.cpp b/src/main.cpp
index b2421a07..219df488 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -160,18 +160,20 @@ void init_engine()
std::cout << homeDir << " can't be made, but it doesn't exist! Exitting." << std::endl;
exit(1);
}
+#endif
- // Creating and checking the ~/.tmw/updates folder existence and rights.
- std::string dataUpdateDir = homeDir + "/updates";
- //sprintf(dataUpdateDir, "%s/updates", homeDir);
- if ((mkdir(dataUpdateDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
- (errno != EEXIST))
- {
- std::cout << dataUpdateDir << " can't be made, but it doesn't exist! Exitting." << std::endl;
+ if (!PHYSFS_setWriteDir(homeDir.c_str())) {
+ std::cout << homeDir << " couldn't be set as home directory! Exitting." << std::endl;
exit(1);
}
-#endif
+ // Creating and checking the updates folder existence and rights.
+ if (!PHYSFS_exists("/updates")) {
+ if (!PHYSFS_mkdir("/updates")) {
+ std::cout << homeDir << "/updates can't be made, but it doesn't exist! Exitting." << std::endl;
+ exit(1);
+ }
+ }
// Initialize logger
logger = new Logger(homeDir + std::string("/tmw.log"));