Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/shared/Utils.cpp

Issue 10836037: Share code for data path retrieval in engine and plugin (Closed)
Patch Set: Fixed issues in previous patch Created June 4, 2013, 10:14 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/plugin/PluginSettings.cpp ('K') | « src/shared/Utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« src/plugin/PluginSettings.cpp ('K') | « src/shared/Utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld