Create local saves dir if it does not exists (fixes #80)

This commit is contained in:
Simon Robertshaw 2012-08-10 14:34:55 +01:00
parent 3f20b4256b
commit c62f65585a

View File

@ -1,3 +1,8 @@
#ifdef WIN
#include <direct.h>
#else
#include <sys/stat.h>
#endif
#include "LocalSaveActivity.h" #include "LocalSaveActivity.h"
#include "interface/Label.h" #include "interface/Label.h"
#include "interface/Textbox.h" #include "interface/Textbox.h"
@ -105,6 +110,11 @@ void LocalSaveActivity::Save()
void LocalSaveActivity::saveWrite(std::string finalFilename) void LocalSaveActivity::saveWrite(std::string finalFilename)
{ {
#ifdef WIN
_mkdir(LOCAL_SAVE_DIR);
#else
mkdir(LOCAL_SAVE_DIR, 0755);
#endif
Client::Ref().WriteFile(save.GetGameSave()->Serialise(), finalFilename); Client::Ref().WriteFile(save.GetGameSave()->Serialise(), finalFilename);
} }