diff options
| author | jacob1 <jfu614@gmail.com> | 2012-10-19 23:17:15 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-10-26 14:15:38 (GMT) |
| commit | 3a29fc0268dbda68e80f7de586c6692ba7a11565 (patch) | |
| tree | fa2ae1ded7149c2b56c4dcecac032e991b30d00e /src/client/Client.cpp | |
| parent | e2622657f076ef943d051593d0969306daf15f32 (diff) | |
| download | powder-3a29fc0268dbda68e80f7de586c6692ba7a11565.zip powder-3a29fc0268dbda68e80f7de586c6692ba7a11565.tar.gz | |
Save local saves as current name option (overwrites them automatically). Fix filename not showing when first saving a local save
Diffstat (limited to 'src/client/Client.cpp')
| -rw-r--r-- | src/client/Client.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/client/Client.cpp b/src/client/Client.cpp index b35c292..763814a 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -430,6 +430,15 @@ std::vector<std::string> Client::DirectorySearch(std::string directory, std::str return searchResults; } +int Client::MakeDirectory(const char * dirName) +{ +#ifdef WIN + return _mkdir(dirName); +#else + return mkdir(dirName, 0755); +#endif +} + void Client::WriteFile(std::vector<unsigned char> fileData, std::string filename) { try @@ -870,11 +879,7 @@ std::string Client::AddStamp(GameSave * saveData) << std::setw(8) << std::setfill('0') << std::hex << lastStampTime << std::setw(2) << std::setfill('0') << std::hex << lastStampName; -#ifdef WIN - _mkdir(STAMPS_DIR); -#else - mkdir(STAMPS_DIR, 0755); -#endif + MakeDirectory(STAMPS_DIR); int gameDataLength; char * gameData = saveData->Serialise(gameDataLength); @@ -895,12 +900,7 @@ std::string Client::AddStamp(GameSave * saveData) void Client::updateStamps() { - -#ifdef WIN - _mkdir(STAMPS_DIR); -#else - mkdir(STAMPS_DIR, 0755); -#endif + MakeDirectory(STAMPS_DIR); std::ofstream stampsStream; stampsStream.open(std::string(STAMPS_DIR PATH_SEP "stamps.def").c_str(), std::ios::binary); |
