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

Unified Diff: chrome/common/extensions/extension_resource.cc

Issue 334028: From FilePath::AppendAndResolveRelative() to file_util::AbsolutePath(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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/file_path_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_resource.cc
===================================================================
--- chrome/common/extensions/extension_resource.cc (revision 30093)
+++ chrome/common/extensions/extension_resource.cc (working copy)
@@ -40,22 +40,26 @@
std::vector<FilePath> l10n_relative_paths;
extension_l10n_util::GetL10nRelativePaths(relative_path,
&l10n_relative_paths);
+ // We need to resolve the parent references in the extension_root
+ // path on its own because IsParent doesn't like parent references.
+ FilePath clean_extension_root(extension_root);
+ if (!file_util::AbsolutePath(&clean_extension_root))
+ return FilePath();
// Stat l10n file(s), and return new path if it exists.
for (size_t i = 0; i < l10n_relative_paths.size(); ++i) {
- FilePath full_path;
- if (extension_root.AppendAndResolveRelative(l10n_relative_paths[i],
- &full_path) &&
- extension_root.IsParent(full_path) &&
+ FilePath full_path = clean_extension_root.Append(l10n_relative_paths[i]);
+ if (file_util::AbsolutePath(&full_path) &&
+ clean_extension_root.IsParent(full_path) &&
file_util::PathExists(full_path)) {
return full_path;
}
}
// Fall back to root resource.
- FilePath full_path;
- if (extension_root.AppendAndResolveRelative(relative_path, &full_path) &&
- extension_root.IsParent(full_path)) {
+ FilePath full_path = clean_extension_root.Append(relative_path);
+ if (file_util::AbsolutePath(&full_path) &&
+ clean_extension_root.IsParent(full_path)) {
return full_path;
}
« no previous file with comments | « base/file_path_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698