summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-02-16 14:35:10 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-02-16 14:35:10 +0300
commit40686cc1869953a42f311b6d8a3558e99acef37d (patch)
tree7e6b0d69261ddbfb0aa82535a20eeaf5159103a0 /src
parent1513340956911f3e3efc252bc1a0bae046dc8d3e (diff)
useless checks removed
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/path.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mir_core/src/path.cpp b/src/mir_core/src/path.cpp
index f5db1f286d..99d95d9757 100644
--- a/src/mir_core/src/path.cpp
+++ b/src/mir_core/src/path.cpp
@@ -102,13 +102,12 @@ MIR_CORE_DLL(int) CreateDirectoryTree(const char *szDir)
if (szDir == nullptr)
return 1;
- char szTestDir[MAX_PATH];
- mir_strncpy(szTestDir, szDir, _countof(szTestDir));
-
- DWORD dwAttributes = GetFileAttributesA(szTestDir);
+ DWORD dwAttributes = GetFileAttributesA(szDir);
if (dwAttributes != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return 0;
+ char szTestDir[MAX_PATH];
+ mir_strncpy(szTestDir, szDir, _countof(szTestDir));
char *pszLastBackslash = strrchr(szTestDir, '\\');
if (pszLastBackslash == nullptr)
return 0;
@@ -192,13 +191,12 @@ MIR_CORE_DLL(int) CreateDirectoryTreeW(const wchar_t *szDir)
if (szDir == nullptr)
return 1;
- wchar_t szTestDir[MAX_PATH];
- mir_wstrncpy(szTestDir, szDir, _countof(szTestDir));
-
- DWORD dwAttributes = GetFileAttributesW(szTestDir);
+ DWORD dwAttributes = GetFileAttributesW(szDir);
if (dwAttributes != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return 0;
+ wchar_t szTestDir[MAX_PATH];
+ mir_wstrncpy(szTestDir, szDir, _countof(szTestDir));
wchar_t *pszLastBackslash = wcsrchr(szTestDir, '\\');
if (pszLastBackslash == nullptr)
return 0;