- } else {
- std::string userdir = PHYSFS_getUserDir();
-
- // Set configuration directory
- writedir = userdir + WRITEDIR_NAME;
- if(!PHYSFS_setWriteDir(writedir.c_str())) {
- // try to create the directory
- if(!PHYSFS_setWriteDir(userdir.c_str()) || !PHYSFS_mkdir(WRITEDIR_NAME)) {
- std::ostringstream msg;
- msg << "Failed creating configuration directory '"
- << writedir << "': " << PHYSFS_getLastError();
- throw std::runtime_error(msg.str());
- }
-
- if(!PHYSFS_setWriteDir(writedir.c_str())) {
- std::ostringstream msg;
- msg << "Failed to use configuration directory '"
- << writedir << "': " << PHYSFS_getLastError();
- throw std::runtime_error(msg.str());
- }
- }