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

Unified Diff: extensions/common/extension_resource.cc

Issue 13196006: Move path functions from file_util to FilePath object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 8 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
Index: extensions/common/extension_resource.cc
diff --git a/extensions/common/extension_resource.cc b/extensions/common/extension_resource.cc
index 5a70539cce60483882390e91ec467bfd72870a32..cdd7fce79e62b85ebc4e4ed7a7c84968c7a97622 100644
--- a/extensions/common/extension_resource.cc
+++ b/extensions/common/extension_resource.cc
@@ -52,8 +52,9 @@ base::FilePath ExtensionResource::GetFilePath(
SymlinkPolicy symlink_policy) {
// We need to resolve the parent references in the extension_root
// path on its own because IsParent doesn't like parent references.
- base::FilePath clean_extension_root(extension_root);
- if (!file_util::AbsolutePath(&clean_extension_root))
+ base::FilePath clean_extension_root(
+ base::MakeAbsoluteFilePath(extension_root));
+ if (clean_extension_root.empty())
return base::FilePath();
base::FilePath full_path = clean_extension_root.Append(relative_path);
@@ -80,13 +81,14 @@ base::FilePath ExtensionResource::GetFilePath(
// We must resolve the absolute path of the combined path when
// the relative path contains references to a parent folder (i.e., '..').
- // We also check if the path exists because the posix version of AbsolutePath
- // will fail if the path doesn't exist, and we want the same behavior on
- // Windows... So until the posix and Windows version of AbsolutePath are
- // unified, we need an extra call to PathExists, unfortunately.
- // TODO(mad): Fix this once AbsolutePath is unified.
- if (file_util::AbsolutePath(&full_path) &&
- file_util::PathExists(full_path) &&
+ // We also check if the path exists because the posix version of
+ // MakeAbsoluteFilePath will fail if the path doesn't exist, and we want the
+ // same behavior on Windows... So until the posix and Windows version of
+ // MakeAbsoluteFilePath are unified, we need an extra call to PathExists,
+ // unfortunately.
+ // TODO(mad): Fix this once MakeAbsoluteFilePath is unified.
+ full_path = base::MakeAbsoluteFilePath(full_path);
+ if (file_util::PathExists(full_path) &&
(symlink_policy == FOLLOW_SYMLINKS_ANYWHERE ||
clean_extension_root.IsParent(full_path))) {
return full_path;

Powered by Google App Engine
This is Rietveld 408576698