mirror of
https://github.com/NixOS/nix
synced 2025-06-25 23:11:16 +02:00
Merge pull request #10306 from hercules-ci/baseNameOf
Test and document `builtins.baseNameOf`, improve internal `baseNameOf()`
This commit is contained in:
commit
1394d4e9c5
5 changed files with 76 additions and 6 deletions
|
@ -128,7 +128,7 @@ std::string_view baseNameOf(std::string_view path)
|
|||
return "";
|
||||
|
||||
auto last = path.size() - 1;
|
||||
if (path[last] == '/' && last > 0)
|
||||
while (last > 0 && path[last] == '/')
|
||||
last -= 1;
|
||||
|
||||
auto pos = path.rfind('/', last);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue