diff options
-rw-r--r-- | src/net/download.cpp | 8 | ||||
-rw-r--r-- | src/utils/files.cpp | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp index 38b8d2873..0f25d56d8 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -26,6 +26,7 @@ #include "logger.h" #include "main.h" +#include "utils/files.h" #include "utils/sdlhelper.h" #include <curl/curl.h> @@ -364,12 +365,7 @@ int Download::downloadThread(void *ptr) if (!d->mOptions.cancel) { ::remove(d->mFileName.c_str()); -#if defined __native_client__ - Files::renameFile( -#else - ::rename( -#endif - outFilename.c_str(), d->mFileName.c_str()); + Files::renameFile(outFilename, d->mFileName); // Check if we can open it and no errors were encountered // during renaming diff --git a/src/utils/files.cpp b/src/utils/files.cpp index cb43ff5df..216a83991 100644 --- a/src/utils/files.cpp +++ b/src/utils/files.cpp @@ -126,6 +126,7 @@ void Files::extractZip(const std::string &restrict zipName, int Files::renameFile(const std::string &restrict srcName, const std::string &restrict dstName) { +#if defined __native_client__ FILE *srcFile = fopen(srcName.c_str(), "rb"); if (srcFile == nullptr) return -1; @@ -158,4 +159,7 @@ int Files::renameFile(const std::string &restrict srcName, return 0; return -1; +#else + return ::rename(srcName.c_str(), dstName.c_str()); +#endif } |