| Index: src/DefaultFileSystem.cpp |
| =================================================================== |
| --- a/src/DefaultFileSystem.cpp |
| +++ b/src/DefaultFileSystem.cpp |
| @@ -11,6 +11,7 @@ |
| #ifdef _WIN32 |
| #ifndef S_ISDIR |
| #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) |
| +#include <Shlobj.h> |
| #endif |
| #ifndef S_ISREG |
| @@ -81,3 +82,25 @@ |
| result.lastModified = static_cast<int64_t>(nativeStat.st_mtime) * 1000; |
| return result; |
| } |
| + |
| +std::string DefaultFileSystem::Resolve(const std::string& path) const |
| +{ |
| +#ifdef WIN32 |
| + // Resolve to LocalLow folder |
| + wchar_t* resolvedPath; |
| + HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, NULL, &resolvedPath); |
| + if (FAILED(hr)) |
| + return std::string(path); |
|
Wladimir Palant
2013/04/24 09:17:35
Why not just return path; here?
|
| + std::wstring resolvedW(resolvedPath); |
| + CoTaskMemFree(resolvedPath); |
| + |
| + // TODO: Better conversion here |
| + std::string resolved(resolvedW.begin(), resolvedW.end()); |
|
Wladimir Palant
2013/04/24 09:17:35
Please use Utils::ToUTF8String() here (and we are
|
| + resolved.append("\\AdblockPlus\\"); |
| + resolved.append(path); |
| + return resolved; |
| +#else |
| + return std::string(path); |
|
Wladimir Palant
2013/04/24 09:17:35
Why not just return path; here?
|
| +#endif |
| +} |
| + |