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

Side by Side Diff: src/engine/Utils.cpp

Issue 10790071: Send debug output to a file (Closed)
Patch Set: Created May 31, 2013, 9:54 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #include "stdafx.h"
2 #include "Utils.h"
3
4 namespace
5 {
6 static std::wstring appDataPath;
7
8 bool IsWindowsVistaOrLater()
9 {
10 OSVERSIONINFOEX osvi;
11 ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
12 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
13 GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&osvi));
14 return osvi.dwMajorVersion >= 6;
15 }
16 }
17
18 std::wstring GetAppDataPath()
19 {
20 if (appDataPath.empty())
21 {
22 if (IsWindowsVistaOrLater())
23 {
24 WCHAR* pathBuffer;
25 if (FAILED(SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, 0, &pathBuffe r)))
26 throw std::runtime_error("Unable to find app data directory");
27 appDataPath.assign(pathBuffer);
28 CoTaskMemFree(pathBuffer);
29 }
30 else
31 {
32 std::auto_ptr<wchar_t> pathBuffer(new wchar_t[MAX_PATH]);
33 if (!SHGetSpecialFolderPath(0, pathBuffer.get(), CSIDL_LOCAL_APPDATA, true ))
34 throw std::runtime_error("Unable to find app data directory");
35 appDataPath.assign(pathBuffer.get());
36 }
37 appDataPath += L"\\AdblockPlus";
38 }
39 return appDataPath;
40 }
OLDNEW
« src/engine/Debug.cpp ('K') | « src/engine/Utils.h ('k') | src/engine/main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld