wobsite.url.file_url
Show source codeHide source code
fn pub file_url(directory: ref Path, path: ref Path) -> String {
let rel = path.strip_prefix(directory).or_else(fn { path.clone })
if rel.to_string == INDEX_FILE {
'/'
} else if rel.tail == INDEX_FILE {
'/${rel.directory.with_extension('')}/'
} else {
'/${rel.with_extension('')}/'
}
}
fn pub static file_url(directory: ref Path, path: ref Path) -> String
Returns the relative URL for a file path in a directory.