diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-17 16:20:20 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-17 16:20:20 +0000 |
commit | c61eff4bc0a9ebdfb43b8e68b345fa53456378a5 (patch) | |
tree | 7c9d224d57b7a912e6282db4ffb53a09f66e5142 /plugins/PluginUpdater/src/unzipfile.cpp | |
parent | 3cc2e824092b0b542b3d1857bb742514560b0f32 (diff) |
bunch of fixes for updater:
- fix to update FingerPrint icons;
- fix to move files across different disks;
- five nasty clutches removed;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@2336 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src/unzipfile.cpp')
-rw-r--r-- | plugins/PluginUpdater/src/unzipfile.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index c5f39e1451..b2b621d37a 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -26,12 +26,9 @@ extern "C" void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def);
}
-void PrepareFileName(TCHAR *dest, size_t destSize, const TCHAR *ptszPath, const TCHAR *ptszFileName)
+static void PrepareFileName(TCHAR *dest, size_t destSize, const TCHAR *ptszPath, const TCHAR *ptszFileName)
{
- if (ptszPath)
- mir_sntprintf(dest, destSize, _T("%s\\%s"), ptszPath, ptszFileName);
- else
- mir_sntprintf(dest, destSize, _T("%s"), ptszFileName);
+ mir_sntprintf(dest, destSize, _T("%s\\%s"), ptszPath, ptszFileName);
for (TCHAR *p = dest; *p; ++p)
if (*p == '/')
@@ -42,7 +39,10 @@ void BackupFile(TCHAR *ptszSrcFileName, TCHAR *ptszBackFileName) {
CreatePathToFileT(ptszBackFileName);
DeleteFile(ptszBackFileName);
- MoveFile(ptszSrcFileName, ptszBackFileName);
+ if ( MoveFile(ptszSrcFileName, ptszBackFileName) == 0) { // use copy on error
+ CopyFile(ptszSrcFileName, ptszBackFileName, FALSE);
+ DeleteFile(ptszSrcFileName);
+ }
}
bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath)
|