diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-07-30 11:55:28 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-07-30 11:55:28 +0000 |
commit | 25d4e1e3fe393ee845c868a9e5c163de52748379 (patch) | |
tree | 62021f2521334e1e05e5a44a0e8d63ef849dc7e7 /src/main.cpp | |
parent | 5b6ca06022be1f78b5c39387f71a7bf6580a66bd (diff) | |
download | mana-25d4e1e3fe393ee845c868a9e5c163de52748379.tar.gz mana-25d4e1e3fe393ee845c868a9e5c163de52748379.tar.bz2 mana-25d4e1e3fe393ee845c868a9e5c163de52748379.tar.xz mana-25d4e1e3fe393ee845c868a9e5c163de52748379.zip |
Fixed check for updates directory. Moved search/write path setup from resourcemanager to main initialization.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp index 219df488..b0608c9a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -162,21 +162,33 @@ void init_engine() } #endif - if (!PHYSFS_setWriteDir(homeDir.c_str())) { + // Initialize logger + logger = new Logger(homeDir + std::string("/tmw.log")); + + ResourceManager *resman = ResourceManager::getInstance(); + + if (!resman->setWriteDir(homeDir)) { std::cout << homeDir << " couldn't be set as home directory! Exitting." << std::endl; exit(1); } + // Add the user's homedir to PhysicsFS search path + resman->addToSearchPath(homeDir, false); // Creating and checking the updates folder existence and rights. - if (!PHYSFS_exists("/updates")) { - if (!PHYSFS_mkdir("/updates")) { + if (!resman->isDirectory("/updates")) { + if (!resman->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")); + // Add the main data directory to our PhysicsFS search path + resman->addToSearchPath("data", true); + resman->addToSearchPath(TMW_DATADIR "data", 1); + // Add zip files to PhysicsFS + resman->searchAndAddArchives("/", ".zip", true); + // Updates, these override other files + resman->searchAndAddArchives("/updates", ".zip", false); // Fill configuration with defaults config.setValue("host", "animesites.de"); @@ -297,8 +309,6 @@ void init_engine() // Create the graphics context graphics = new Graphics(screen); - ResourceManager *resman = ResourceManager::getInstance(); - login_wallpaper = resman->getImage( "graphics/images/login_wallpaper.png"); Image *playerImg = resman->getImage( @@ -389,7 +399,6 @@ int main(int argc, char *argv[]) init_engine(); - SDL_Event event; while (state != EXIT) |