summaryrefslogtreecommitdiff
path: root/src/client/Client.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-07-21 12:09:59 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-07-21 12:09:59 (GMT)
commit5bf0a084ace0e6b673efa4552b40de8b36e0668e (patch)
tree8683ff6c11167cb3b95f7b4ae65269b3cb6dce98 /src/client/Client.cpp
parent78b1ffb11dc78130cdb120acf37d5930807bff6c (diff)
downloadpowder-5bf0a084ace0e6b673efa4552b40de8b36e0668e.zip
powder-5bf0a084ace0e6b673efa4552b40de8b36e0668e.tar.gz
Prevent race condition when reloading local stamps, fix task so "after()" gets called and correct stamp name so they actually get deleted"
Diffstat (limited to 'src/client/Client.cpp')
-rw-r--r--src/client/Client.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/client/Client.cpp b/src/client/Client.cpp
index 5ecb8ac..116fa02 100644
--- a/src/client/Client.cpp
+++ b/src/client/Client.cpp
@@ -371,7 +371,7 @@ SaveFile * Client::GetStamp(string stampID)
stampFile.read((char *)tempData, fileSize);
stampFile.close();
- SaveFile * file = new SaveFile(string(STAMPS_DIR PATH_SEP + stampID + ".stm").c_str());
+ SaveFile * file = new SaveFile(string(stampID).c_str());
GameSave * tempSave = new GameSave((char *)tempData, fileSize);
file->SetGameSave(tempSave);
return file;
@@ -388,7 +388,12 @@ void Client::DeleteStamp(string stampID)
{
if((*iterator) == stampID)
{
- remove(string(STAMPS_DIR PATH_SEP + stampID + ".stm").c_str());
+ stringstream stampFilename;
+ stampFilename << STAMPS_DIR;
+ stampFilename << PATH_SEP;
+ stampFilename << stampID;
+ stampFilename << ".stm";
+ remove(stampFilename.str().c_str());
stampIDs.erase(iterator);
return;
}