diff options
author | George Hazan <ghazan@miranda.im> | 2020-02-16 14:35:10 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-02-16 14:35:10 +0300 |
commit | 40686cc1869953a42f311b6d8a3558e99acef37d (patch) | |
tree | 7e6b0d69261ddbfb0aa82535a20eeaf5159103a0 /plugins | |
parent | 1513340956911f3e3efc252bc1a0bae046dc8d3e (diff) |
useless checks removed
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Toaster/src/main.cpp | 5 | ||||
-rw-r--r-- | plugins/TrafficCounter/src/statistics.cpp | 13 |
2 files changed, 8 insertions, 10 deletions
diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp index 7aeb3bee78..470399a83d 100644 --- a/plugins/Toaster/src/main.cpp +++ b/plugins/Toaster/src/main.cpp @@ -61,10 +61,7 @@ int CMPlugin::Load() if (GetEnvironmentVariableW(L"TEMP", wszTempDir, MAX_PATH) != 0) {
wcscat_s(wszTempDir, L"\\Miranda.Toaster");
-
- DWORD dwAttributes = GetFileAttributes(wszTempDir);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(wszTempDir);
+ CreateDirectoryTreeW(wszTempDir);
}
else MessageBox(nullptr, TranslateT("Failed to create temporary directory"), _T(MODULENAME), MB_OK | MB_ICONERROR);
diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp index a0872b769e..b97e34b7b1 100644 --- a/plugins/TrafficCounter/src/statistics.cpp +++ b/plugins/TrafficCounter/src/statistics.cpp @@ -296,13 +296,14 @@ void Stat_ReadFile(PROTOLIST &p) {
LARGE_INTEGER Size;
DWORD BytesRead;
- wchar_t FileName[MAX_PATH], *pszPath;
- SYSTEMTIME stNow;
+ wchar_t FileName[MAX_PATH];
+ {
+ VARSW pszPath(Utils_ReplaceVarsW(L"%miranda_userdata%\\statistics"));
+ CreateDirectoryTreeW(pszPath);
+ mir_snwprintf(FileName, L"%s\\%S.stat", pszPath.get(), p.name);
+ }
- pszPath = Utils_ReplaceVarsW(L"%miranda_userdata%\\statistics");
- CreateDirectoryTreeW(pszPath);
- mir_snwprintf(FileName, L"%s\\%S.stat", pszPath, p.name);
- mir_free(pszPath);
+ SYSTEMTIME stNow;
GetLocalTime(&stNow);
p.hFile = CreateFile(FileName, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|