| Index: src/shared/Utils.cpp |
| =================================================================== |
| rename from src/engine/Utils.cpp |
| rename to src/shared/Utils.cpp |
| --- a/src/engine/Utils.cpp |
| +++ b/src/shared/Utils.cpp |
| @@ -1,14 +1,16 @@ |
| -#include "stdafx.h" |
| +#include <Windows.h> |
| +#include <ShlObj.h> |
| + |
| #include "Utils.h" |
| namespace |
| { |
| - static std::wstring appDataPath; |
| + std::wstring appDataPath; |
| bool IsWindowsVistaOrLater() |
| { |
| OSVERSIONINFOEX osvi; |
| ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); |
| osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); |
| GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&osvi)); |
| return osvi.dwMajorVersion >= 6; |
| @@ -29,12 +31,15 @@ std::wstring GetAppDataPath() |
| } |
| else |
| { |
| std::auto_ptr<wchar_t> pathBuffer(new wchar_t[MAX_PATH]); |
| if (!SHGetSpecialFolderPath(0, pathBuffer.get(), CSIDL_LOCAL_APPDATA, true)) |
| throw std::runtime_error("Unable to find app data directory"); |
| appDataPath.assign(pathBuffer.get()); |
| } |
| - appDataPath += L"\\AdblockPlus"; |
| + appDataPath += L"\\Adblock Plus for IE"; |
| + |
| + // Ignore errors here, this isn't a critical operation |
| + ::CreateDirectoryW(appDataPath.c_str(), NULL); |
| } |
| return appDataPath; |
| } |