summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension_resource.cc
diff options
context:
space:
mode:
authormad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 01:37:23 +0000
committermad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 01:37:23 +0000
commitb9312d8cb3c4da74b11070569d229471f70fd566 (patch)
treea876d97eb98391671892c71f24d40a06c895e8ce /chrome/common/extensions/extension_resource.cc
parent99e9d796bb22f7a87fae907311f491b2ed02dfb6 (diff)
downloadchromium_src-b9312d8cb3c4da74b11070569d229471f70fd566.zip
chromium_src-b9312d8cb3c4da74b11070569d229471f70fd566.tar.gz
chromium_src-b9312d8cb3c4da74b11070569d229471f70fd566.tar.bz2
The existing file_util::AbsolutePath() function was already doing what we needed to do in the ExtensionResource class.
BUG= http://crbug.com/25681 & http://crbug.com/25131 Review URL: http://codereview.chromium.org/334028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_resource.cc')
-rw-r--r--chrome/common/extensions/extension_resource.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/chrome/common/extensions/extension_resource.cc b/chrome/common/extensions/extension_resource.cc
index e92a8d0..46e9e42 100644
--- a/chrome/common/extensions/extension_resource.cc
+++ b/chrome/common/extensions/extension_resource.cc
@@ -40,22 +40,26 @@ FilePath ExtensionResource::GetFilePath(const FilePath& extension_root,
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;
}