diff options
author | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-04-07 00:07:56 +0000 |
---|---|---|
committer | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-04-07 00:07:56 +0000 |
commit | 92be070586e97f44892da28a592aa1c0925a40d1 (patch) | |
tree | e36edfc2a064a88f75ee18ac5ef67adaa5a399d8 /updater/utils.cpp | |
parent | 9d777637239fed893c26c7d8aee3f929937311ba (diff) |
Fixed updating issues
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@502 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'updater/utils.cpp')
-rw-r--r-- | updater/utils.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/updater/utils.cpp b/updater/utils.cpp index 6e1afad..98d57be 100644 --- a/updater/utils.cpp +++ b/updater/utils.cpp @@ -47,11 +47,26 @@ int CheckForFileID(char *update_url, char *version_url, char *name) { return -1;
}
-bool CreatePath(const TCHAR *path)
+bool CreatePath(const TCHAR *szDir)
{
- if (!path) return false;
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path);
- return true;
+ if (!szDir) return false;
+
+ DWORD dwAttributes;
+ TCHAR *pszLastBackslash, szTestDir[ MAX_PATH ];
+
+ lstrcpyn( szTestDir, szDir, SIZEOF( szTestDir ));
+ if (( dwAttributes = GetFileAttributes( szTestDir )) != INVALID_FILE_ATTRIBUTES && ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ))
+ return true;
+
+ pszLastBackslash = _tcsrchr( szTestDir, '\\' );
+ if ( pszLastBackslash == NULL )
+ return true;
+
+ *pszLastBackslash = '\0';
+ CreatePath( szTestDir );
+ *pszLastBackslash = '\\';
+
+ return CreateDirectory( szTestDir, NULL ) != 0;
}
// must 'mir_free' return val
|