summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2005-07-16 00:09:13 +0000
committerYohann Ferreira <bertram@cegetel.net>2005-07-16 00:09:13 +0000
commitfc86c594fc0d426f8d80efaeaeddcfe7c6941308 (patch)
tree50ddf70a68d10bac8931d63a633a6290ed7f78d2 /src/main.cpp
parent9cea91975451a7abb6f15e08f7fb6c20efed152c (diff)
downloadmana-fc86c594fc0d426f8d80efaeaeddcfe7c6941308.tar.gz
mana-fc86c594fc0d426f8d80efaeaeddcfe7c6941308.tar.bz2
mana-fc86c594fc0d426f8d80efaeaeddcfe7c6941308.tar.xz
mana-fc86c594fc0d426f8d80efaeaeddcfe7c6941308.zip
Now check for the existence of /home/user/.tmw/data at startup. Will be improved later.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0417be56..29cf08a3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -150,18 +150,31 @@ void init_engine()
exit(1);
}
- // Checking if homeuser/.tmw folder exists.
- sprintf(homeDir, "%s/.tmw/", pass->pw_dir);
+ // Checking if /home/user/.tmw folder exists.
+ sprintf(homeDir, "%s/.tmw", pass->pw_dir);
if ((mkdir(homeDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
(errno != EEXIST))
{
printf("%s can't be made, but it doesn't exist! Exitting.\n", homeDir);
exit(1);
}
+
+ // Creating and checking the ~/.tmw/data folder existence and rights.
+ char *dataUpdateDir = new char [256];
+ sprintf(dataUpdateDir, "%s/data", homeDir);
+ if ((mkdir(dataUpdateDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
+ (errno != EEXIST))
+ {
+ printf("%s can't be made, but it doesn't exist! Exitting.\n", dataUpdateDir);
+ delete dataUpdateDir;
+ exit(1);
+ }
+ delete dataUpdateDir;
+
#endif
// Initialize logger
- logger = new Logger(std::string(homeDir) + std::string("tmw.log"));
+ logger = new Logger(std::string(homeDir) + std::string("/tmw.log"));
// Fill configuration with defaults
config.setValue("host", "animesites.de");
@@ -175,14 +188,19 @@ void init_engine()
config.setValue("sfxVolume", 100);
config.setValue("musicVolume", 60);
config.setValue("fpslimit", 0);
- config.setValue("updatehost", "http://themanaworld.org/");
+ config.setValue("updatehost", "themanaworld.org/files");
config.setValue("customcursor", 1);
+ #ifdef __USE_UNIX98
+ config.setValue("homeDir", homeDir);
+ #else
+ config.setValue("homeDir", TMW_DATADIR);
+ #endif
// Checking if the configuration file exists... otherwise creates it with
// default options !
FILE *tmwFile = 0;
char configPath[256];
- sprintf(configPath, "%sconfig.xml", homeDir);
+ sprintf(configPath, "%s/config.xml", homeDir);
tmwFile = fopen(configPath, "r");
// If we can't read it, it doesn't exist !