diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-16 16:31:28 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-16 16:31:28 +0000 |
commit | 188505284e175f0f75c341c1a7fbe00ca1773324 (patch) | |
tree | e1e868575e2b04b802770eb4579ce96271890dd0 | |
parent | 2242609d9f24588b538af015d3ada1d4a9f8beb1 (diff) | |
download | chromium_src-188505284e175f0f75c341c1a7fbe00ca1773324.zip chromium_src-188505284e175f0f75c341c1a7fbe00ca1773324.tar.gz chromium_src-188505284e175f0f75c341c1a7fbe00ca1773324.tar.bz2 |
Quick fix to use file_util::SetCurrentDirectory method instead of the PathService method, also avoids the conflict with the the windows function.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/196072
Patch from thiago.farina@gmail.com.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26351 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/native_library_win.cc | 13 | ||||
-rw-r--r-- | base/path_service.cc | 4 | ||||
-rw-r--r-- | base/path_service.h | 11 |
3 files changed, 6 insertions, 22 deletions
diff --git a/base/native_library_win.cc b/base/native_library_win.cc index 459e2ff..1c7accf 100644 --- a/base/native_library_win.cc +++ b/base/native_library_win.cc @@ -6,8 +6,7 @@ #include <windows.h> -#include "base/file_path.h" -#include "base/path_service.h" +#include "base/file_util.h" #include "base/string_util.h" namespace base { @@ -17,18 +16,18 @@ NativeLibrary LoadNativeLibrary(const FilePath& library_path) { // Switch the current directory to the library directory as the library // may have dependencies on DLLs in this directory. bool restore_directory = false; - std::wstring current_directory; - if (PathService::Get(base::DIR_CURRENT, ¤t_directory)) { + FilePath current_directory; + if (file_util::GetCurrentDirectory(¤t_directory)) { FilePath plugin_path = library_path.DirName(); - if (!plugin_path.value().empty()) { - PathService::SetCurrentDirectory(plugin_path.value()); + if (!plugin_path.empty()) { + file_util::SetCurrentDirectory(plugin_path); restore_directory = true; } } HMODULE module = LoadLibrary(library_path.value().c_str()); if (restore_directory) - PathService::SetCurrentDirectory(current_directory); + file_util::SetCurrentDirectory(current_directory); return module; } diff --git a/base/path_service.cc b/base/path_service.cc index a1b1db9..da172b3 100644 --- a/base/path_service.cc +++ b/base/path_service.cc @@ -231,10 +231,6 @@ bool PathService::Override(int key, const FilePath& path) { return true; } -bool PathService::SetCurrentDirectory(const std::wstring& current_directory) { - return file_util::SetCurrentDirectory(current_directory); -} - void PathService::RegisterProvider(ProviderFunc func, int key_start, int key_end) { PathData* path_data = GetPathData(); diff --git a/base/path_service.h b/base/path_service.h index c85a39a..39aaa2a 100644 --- a/base/path_service.h +++ b/base/path_service.h @@ -6,14 +6,6 @@ #define BASE_PATH_SERVICE_H_ #include "build/build_config.h" -#ifdef OS_WIN -// TODO(erikkay): this should be removable, but because SetCurrentDirectory -// is the name of a Windows function, it gets macro-ized to SetCurrentDirectoryW -// by windows.h, which leads to a different name in the header vs. the impl. -// Even if we could fix that, it would still hose all callers of the function. -// The right thing is likely to rename. -#include <windows.h> -#endif #include <string> @@ -53,9 +45,6 @@ class PathService { // Return whether a path was overridden. static bool IsOverridden(int key); - // Sets the current directory. - static bool SetCurrentDirectory(const std::wstring& current_directory); - // To extend the set of supported keys, you can register a path provider, // which is just a function mirroring PathService::Get. The ProviderFunc // returns false if it cannot provide a non-empty path for the given key. |