summaryrefslogtreecommitdiff
path: root/plugins/AssocMgr/src/main.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-01-12 19:39:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-01-12 19:39:37 +0000
commit61b011937f55446542eb829004d14336837f1ce7 (patch)
tree0dca06f2437235c3e0869c8f286852c7b4c2d83d /plugins/AssocMgr/src/main.cpp
parent790a76cb05ae8c3700391ccdb49e8e568f8f4283 (diff)
final variant of profile name's fix for AssocMgr
git-svn-id: http://svn.miranda-ng.org/main/trunk@3077 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AssocMgr/src/main.cpp')
-rw-r--r--plugins/AssocMgr/src/main.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/plugins/AssocMgr/src/main.cpp b/plugins/AssocMgr/src/main.cpp
index 225ae3ea21..ae9c789f76 100644
--- a/plugins/AssocMgr/src/main.cpp
+++ b/plugins/AssocMgr/src/main.cpp
@@ -47,28 +47,30 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
{
- TCHAR szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1],*p;
- HANDLE hFile;
-
- if (!GetModuleFileName(hInst,szFileFrom,SIZEOF(szFileFrom)-lstrlen(pszFileName)))
+ TCHAR szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1];
+ if ( !GetModuleFileName(hInst,szFileFrom,SIZEOF(szFileFrom)-lstrlen(pszFileName)))
return;
- p=_tcsrchr(szFileFrom,_T('\\'));
- if(p!=NULL) *(++p)=0;
+
+ TCHAR *p = _tcsrchr(szFileFrom,_T('\\'));
+ if (p != NULL)
+ *(++p) = 0;
lstrcat(szFileFrom,pszFileName); /* buffer safe */
- hFile=CreateFile(szFileFrom,0,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);
- if(hFile==INVALID_HANDLE_VALUE) return;
+ HANDLE hFile = CreateFile(szFileFrom,0,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);
+ if (hFile == INVALID_HANDLE_VALUE)
+ return;
CloseHandle(hFile);
- if (!GetModuleFileNameWorkaround(NULL,szFileTo,SIZEOF(szFileTo)-lstrlen(pszDestSubDir)-lstrlen(pszFileName)))
+ if ( !GetModuleFileName(NULL,szFileTo,SIZEOF(szFileTo)-lstrlen(pszDestSubDir)-lstrlen(pszFileName)))
return;
- p=_tcsrchr(szFileTo,_T('\\'));
- if(p!=NULL) *(++p)=0;
+ p = _tcsrchr(szFileTo,_T('\\'));
+ if (p)
+ *(++p)=0;
lstrcat(szFileTo,pszDestSubDir); /* buffer safe */
CreateDirectory(szFileTo,NULL);
lstrcat(szFileTo,pszFileName); /* buffer safe */
- if (!MoveFile(szFileFrom,szFileTo) && GetLastError()==ERROR_ALREADY_EXISTS) {
+ if ( !MoveFile(szFileFrom,szFileTo) && GetLastError() == ERROR_ALREADY_EXISTS) {
DeleteFile(szFileTo);
MoveFile(szFileFrom,szFileTo);
}