mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 08:07:45 +00:00
AK: Add URL::create_with_file_protocol(path)
This is a convenience helper that allows you to easily construct a file:// URL from an absolute path.
This commit is contained in:
parent
75daf3857b
commit
79eee65372
2 changed files with 10 additions and 0 deletions
|
@ -287,4 +287,12 @@ bool URL::compute_validity() const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
URL URL::create_with_file_protocol(const String& path)
|
||||||
|
{
|
||||||
|
URL url;
|
||||||
|
url.set_protocol("file");
|
||||||
|
url.set_path(path);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
2
AK/URL.h
2
AK/URL.h
|
@ -65,6 +65,8 @@ public:
|
||||||
|
|
||||||
URL complete_url(const String&) const;
|
URL complete_url(const String&) const;
|
||||||
|
|
||||||
|
static URL create_with_file_protocol(const String& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool parse(const StringView&);
|
bool parse(const StringView&);
|
||||||
bool compute_validity() const;
|
bool compute_validity() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue