Skip to content

Commit

Permalink
Fix 'make_url' to handle absolute paths properly, allows servo comman…
Browse files Browse the repository at this point in the history
…d line to handle absolute paths.
  • Loading branch information
Josh Aas committed Apr 12, 2013
1 parent 4b1ab13 commit ca84c0b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/servo-gfx/util/url.rs
Expand Up @@ -20,9 +20,13 @@ pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
let mut schm = url::get_scheme(str_url);
let str_url = if result::is_err(&schm) {
if current_url.is_none() {
// If all we have is a filename, assume it's a local relative file
// and build an absolute path with the cwd
~"file://" + os::getcwd().push(str_url).to_str()
// Assume we've been given a file path. If it's absolute just return
// it, otherwise make it absolute with the cwd.
if str_url[0] == "/"[0] {
~"file://" + str_url
} else {
~"file://" + os::getcwd().push(str_url).to_str()
}
} else {
let current_url = current_url.get();
debug!("make_url: current_url: %?", current_url);
Expand Down

0 comments on commit ca84c0b

Please sign in to comment.