Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: cloud_print/virtual_driver/win/port_monitor/port_monitor.cc

Issue 681533002: remove DIR_LOCAL_APP_DATA_LOW from base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/path_service_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
index 26f7b3f457ac55aaa159583d4256ef4998d48df1..28c4a3b92ca81bbf66c16a13588769267bcc798b 100644
--- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
+++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
@@ -106,14 +106,22 @@ MONITOR2 g_monitor_2 = {
Monitor2Shutdown
};
+base::FilePath GetLocalAppDataLow() {
+ wchar_t system_buffer[MAX_PATH];
+ if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT,
+ system_buffer)))
+ return base::FilePath();
+ return base::FilePath(system_buffer).DirName().AppendASCII("LocalLow");
+}
+
base::FilePath GetAppDataDir() {
base::FilePath file_path;
- base::win::Version version = base::win::GetVersion();
- int path_id = (version >= base::win::VERSION_VISTA) ?
- base::DIR_LOCAL_APP_DATA_LOW : base::DIR_LOCAL_APP_DATA;
- if (!PathService::Get(path_id, &file_path)) {
- LOG(ERROR) << "Can't get DIR_LOCAL_APP_DATA";
- return base::FilePath();
+ if (base::win::GetVersion() >= base::win::VERSION_VISTA)
+ file_path = GetLocalAppDataLow();
+ else
+ PathService::Get(base::DIR_LOCAL_APP_DATA, &file_path);
+ if (file_path.empty()) {
+ LOG(ERROR) << "Can't get app data dir";
}
return file_path.Append(kAppDataDir);
}
« no previous file with comments | « base/path_service_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698