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

Side by Side Diff: base/base_paths_win.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « base/base_paths_mac.mm ('k') | base/base_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <windows.h> 5 #include <windows.h>
6 #include <shlobj.h> 6 #include <shlobj.h>
7 7
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 14 matching lines...) Expand all
25 // names longer than MAX_PATH, but the system functions don't seem to be 25 // names longer than MAX_PATH, but the system functions don't seem to be
26 // designed for it either, with the exception of GetTempPath (but other 26 // designed for it either, with the exception of GetTempPath (but other
27 // things will surely break if the temp path is too long, so we don't bother 27 // things will surely break if the temp path is too long, so we don't bother
28 // handling it. 28 // handling it.
29 wchar_t system_buffer[MAX_PATH]; 29 wchar_t system_buffer[MAX_PATH];
30 system_buffer[0] = 0; 30 system_buffer[0] = 0;
31 31
32 FilePath cur; 32 FilePath cur;
33 switch (key) { 33 switch (key) {
34 case base::FILE_EXE: 34 case base::FILE_EXE:
35 GetModuleFileName(NULL, system_buffer, MAX_PATH); 35 if (GetModuleFileName(NULL, system_buffer, MAX_PATH) == 0)
36 return false;
36 cur = FilePath(system_buffer); 37 cur = FilePath(system_buffer);
37 break; 38 break;
38 case base::FILE_MODULE: { 39 case base::FILE_MODULE: {
39 // the resource containing module is assumed to be the one that 40 // the resource containing module is assumed to be the one that
40 // this code lives in, whether that's a dll or exe 41 // this code lives in, whether that's a dll or exe
41 HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase); 42 HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase);
42 GetModuleFileName(this_module, system_buffer, MAX_PATH); 43 if (GetModuleFileName(this_module, system_buffer, MAX_PATH) == 0)
44 return false;
43 cur = FilePath(system_buffer); 45 cur = FilePath(system_buffer);
44 break; 46 break;
45 } 47 }
46 case base::DIR_WINDOWS: 48 case base::DIR_WINDOWS:
47 GetWindowsDirectory(system_buffer, MAX_PATH); 49 GetWindowsDirectory(system_buffer, MAX_PATH);
48 cur = FilePath(system_buffer); 50 cur = FilePath(system_buffer);
49 break; 51 break;
50 case base::DIR_SYSTEM: 52 case base::DIR_SYSTEM:
51 GetSystemDirectory(system_buffer, MAX_PATH); 53 GetSystemDirectory(system_buffer, MAX_PATH);
52 cur = FilePath(system_buffer); 54 cur = FilePath(system_buffer);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 break; 188 break;
187 default: 189 default:
188 return false; 190 return false;
189 } 191 }
190 192
191 *result = cur; 193 *result = cur;
192 return true; 194 return true;
193 } 195 }
194 196
195 } // namespace base 197 } // namespace base
OLDNEW
« no previous file with comments | « base/base_paths_mac.mm ('k') | base/base_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698