summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-25 17:44:50 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-25 17:44:50 +0000
commit03d8d70b5dffb2ad24a2abd7cb85e958e9d18215 (patch)
tree8aeec425a21e14b6fe33288a1ff0474dab1d8888 /src
parent077e58415a7f6f2c55865be2c2fc35892450dd38 (diff)
downloadmana-03d8d70b5dffb2ad24a2abd7cb85e958e9d18215.tar.gz
mana-03d8d70b5dffb2ad24a2abd7cb85e958e9d18215.tar.bz2
mana-03d8d70b5dffb2ad24a2abd7cb85e958e9d18215.tar.xz
mana-03d8d70b5dffb2ad24a2abd7cb85e958e9d18215.zip
Fixed updating on Windows (rename was failing when target file existed).
Diffstat (limited to 'src')
-rw-r--r--src/gui/updatewindow.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 8f43903f..3f5fe7bb 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -106,8 +106,7 @@ UpdaterWindow::~UpdaterWindow()
free(mMemoryBuffer);
}
- // Remove downloaded files
- remove((mBasePath + "/updates/news.txt").c_str());
+ // Remove possibly leftover temporary download
remove((mBasePath + "/updates/download.temp").c_str());
delete[] mCurlError;
@@ -293,10 +292,14 @@ int UpdaterWindow::downloadThread(void *ptr)
if (!uw->mStoreInMemory)
{
fclose(outfile);
- // If the download was successful give the file the proper name
- // else it will be deleted later
+
+ // Give the file the proper name
std::string newName(uw->mBasePath + "/updates/" +
uw->mCurrentFile.c_str());
+
+ // Any existing file with this name is deleted first, otherwise the
+ // rename will fail on Windows.
+ remove(newName.c_str());
rename(outFilename.c_str(), newName.c_str());
}
}