mirror of
https://github.com/NixOS/nix.git
synced 2025-11-17 16:02:43 +01:00
absPath: just take a std::string_view
1. Slightly more efficient 2. Easier to call Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
This commit is contained in:
parent
268c49264a
commit
beed00c04e
3 changed files with 15 additions and 7 deletions
|
|
@ -6,11 +6,11 @@ namespace nix {
|
|||
CanonPath CanonPath::root = CanonPath("/");
|
||||
|
||||
CanonPath::CanonPath(std::string_view raw)
|
||||
: path(absPath((Path) raw, "/"))
|
||||
: path(absPath(raw, "/"))
|
||||
{ }
|
||||
|
||||
CanonPath::CanonPath(std::string_view raw, const CanonPath & root)
|
||||
: path(absPath((Path) raw, root.abs()))
|
||||
: path(absPath(raw, root.abs()))
|
||||
{ }
|
||||
|
||||
CanonPath::CanonPath(const std::vector<std::string> & elems)
|
||||
|
|
@ -22,7 +22,7 @@ CanonPath::CanonPath(const std::vector<std::string> & elems)
|
|||
|
||||
CanonPath CanonPath::fromCwd(std::string_view path)
|
||||
{
|
||||
return CanonPath(unchecked_t(), absPath((Path) path));
|
||||
return CanonPath(unchecked_t(), absPath(path));
|
||||
}
|
||||
|
||||
std::optional<CanonPath> CanonPath::parent() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue