summaryrefslogtreecommitdiff
path: root/src/gui/updatewindow.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2007-02-01 21:26:20 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2007-02-01 21:26:20 +0000
commitc920d8e57980dfc17702fd510e3cfa244a58d878 (patch)
treee8e08ebdcad35e12afcf670a026bbeb1f998daa0 /src/gui/updatewindow.cpp
parent7193be01bb2a04f02880a42bcacc2b2ec39acf29 (diff)
downloadmana-c920d8e57980dfc17702fd510e3cfa244a58d878.tar.gz
mana-c920d8e57980dfc17702fd510e3cfa244a58d878.tar.bz2
mana-c920d8e57980dfc17702fd510e3cfa244a58d878.tar.xz
mana-c920d8e57980dfc17702fd510e3cfa244a58d878.zip
File handle should be closed before attempting to remove/rename files.
Diffstat (limited to 'src/gui/updatewindow.cpp')
-rw-r--r--src/gui/updatewindow.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 670baf29..c763e488 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -332,15 +332,6 @@ int UpdaterWindow::downloadThread(void *ptr)
if (!uw->mStoreInMemory)
{
- // 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());
-
// Don't check resources2.txt checksum
if (uw->mDownloadStatus == UPDATE_RESOURCES)
{
@@ -350,7 +341,7 @@ int UpdaterWindow::downloadThread(void *ptr)
{
uw->mDownloadComplete = false;
// Remove the corrupted file
- ::remove(newName.c_str());
+ ::remove(outFilename.c_str());
logger->log(
"Checksum for file %s failed: (%lx/%lx)",
uw->mCurrentFile.c_str(),
@@ -359,6 +350,15 @@ int UpdaterWindow::downloadThread(void *ptr)
}
fclose(outfile);
+
+ // 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());
}
}
attempts++;