Commit 0135aa17 authored by mstensho@opera.com's avatar mstensho@opera.com

Support relative file paths in FilePathToFileURL().

This makes it possible for content_shell to resolve relative file paths
on the command line and turn them into proper startup URLs.

BUG=336416

Review URL: https://codereview.chromium.org/137233006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246278 0039d316-1c4b-4281-b951-d872f2087c98
parent 1e0f832b
...@@ -998,6 +998,12 @@ GURL FilePathToFileURL(const base::FilePath& path) { ...@@ -998,6 +998,12 @@ GURL FilePathToFileURL(const base::FilePath& path) {
// "file://///server/path" for UNC. The URL canonicalizer will fix up the // "file://///server/path" for UNC. The URL canonicalizer will fix up the
// latter case to be the canonical UNC form: "file://server/path" // latter case to be the canonical UNC form: "file://server/path"
base::FilePath::StringType url_string(kFileURLPrefix); base::FilePath::StringType url_string(kFileURLPrefix);
if (!path.IsAbsolute()) {
base::FilePath current_dir;
PathService::Get(base::DIR_CURRENT, &current_dir);
url_string.append(current_dir.value());
url_string.push_back(base::FilePath::kSeparators[0]);
}
url_string.append(path.value()); url_string.append(path.value());
// Now do replacement of some characters. Since we assume the input is a // Now do replacement of some characters. Since we assume the input is a
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment