Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/savegamemenu.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/client/savegamemenu.cc b/src/client/savegamemenu.cc
index 9f8ee99..be26cd4 100644
--- a/src/client/savegamemenu.cc
+++ b/src/client/savegamemenu.cc
@@ -13,6 +13,7 @@
#include "client/savegamemenu.h"
#include "filesystem/filesystem.h"
#include "ui/ui.h"
+#include "sys/sys.h"
namespace client
{
@@ -297,6 +298,7 @@ void SaveGameMenu::savegame(std::string savename)
return;
}
+ // find an approriate savegame name if none was specified
if (!savename.size()) {
std::string filename;
unsigned long n = 0;
@@ -312,6 +314,13 @@ void SaveGameMenu::savegame(std::string savename)
} while (sys::file_exists(filename));
}
+ // create savegame diretory if required
+ std::string savegamepath(filesystem::writedir());
+ savegamepath.append("savegames");
+ if (!sys::directory_exists(savegamepath)) {
+ sys::mkdir(savegamepath);
+ }
+
filesystem::OFileStream ofs("savegames/" + savename + ".ini");
con_debug << "Saving " << ofs.filename() << std::endl;