diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2016-04-15 18:29:35 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2016-04-15 18:29:35 +0000 |
commit | 01f01c04263bae7f66e191976f45b5e03487a935 (patch) | |
tree | 4ef1276a4c13b411a8447e29243c7c01df2e4da9 /plugins/PluginUpdater | |
parent | a2815e07fd20b5ac71c85df4a3707174a05ab628 (diff) |
PluginUpdater:
- Fixed updating
git-svn-id: http://svn.miranda-ng.org/main/trunk@16666 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r-- | plugins/PluginUpdater/src/DlgUpdate.cpp | 18 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/stdafx.h | 8 |
2 files changed, 16 insertions, 10 deletions
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 701aed3927..542f5fd9b2 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -567,6 +567,8 @@ static renameTable[] = { _T("WART-*.exe"), NULL },
};
+// Checks if file needs to be renamed and copies it in pNewName
+// Returns true if smth. was copied
static bool CheckFileRename(const TCHAR *ptszOldName, TCHAR *pNewName)
{
for (int i = 0; i < _countof(renameTable); i++) {
@@ -627,16 +629,12 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, const TCHAR *tsz else if (isValidExtension(ffd.cFileName)) {
// calculate the current file's relative name and store it into tszNewName
TCHAR tszNewName[MAX_PATH];
- if (!CheckFileRename(ffd.cFileName, tszNewName)) {
- if (level == 0) {
- if (opts.bChangePlatform) {
- if (!mir_tstrcmpi(ffd.cFileName, _T("miranda32.exe")))
- _tcsncpy_s(tszNewName, _T("miranda64.exe"), _TRUNCATE);
- if (!mir_tstrcmpi(ffd.cFileName, _T("miranda64.exe")))
- _tcsncpy_s(tszNewName, _T("miranda32.exe"), _TRUNCATE);
- }
- _tcsncpy_s(tszNewName, ffd.cFileName, _TRUNCATE);
- }
+ if (CheckFileRename(ffd.cFileName, tszNewName))
+ Netlib_LogfT(hNetlibUser, _T("File %s will be renamed to %s."), ffd.cFileName, tszNewName);
+ else {
+ if (level == 0)
+ // Rename Miranda*.exe
+ _tcsncpy_s(tszNewName, opts.bChangePlatform && !mir_tstrcmp(ffd.cFileName, OLD_FILENAME) ? NEW_FILENAME : ffd.cFileName, _TRUNCATE);
else
mir_sntprintf(tszNewName, _T("%s\\%s"), tszFolder + cbBaseLen, ffd.cFileName);
}
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 10ffc6576a..da8f379c07 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -108,12 +108,20 @@ extern struct PlugOptions #define DEFAULT_UPDATE_URL_TRUNK "http://miranda-ng.org/distr/x%d"
#define DEFAULT_UPDATE_URL_TRUNK_SYMBOLS "http://miranda-ng.org/distr/pdb_x%d"
+
+#define FILENAME_X64 _T("miranda64.exe")
+#define FILENAME_X32 _T("miranda32.exe")
+
#ifdef _WIN64
#define DEFAULT_BITS 64
#define DEFAULT_OPP_BITS 32
+ #define OLD_FILENAME FILENAME_X64
+ #define NEW_FILENAME FILENAME_X32
#else
#define DEFAULT_BITS 32
#define DEFAULT_OPP_BITS 64
+ #define OLD_FILENAME FILENAME_X32
+ #define NEW_FILENAME FILENAME_X64
#endif
#define PLUGIN_INFO_URL _T("http://miranda-ng.org/p/%s")
|