baseNameOf
builtins.baseNameOf
Takes 1 arguments
x
Return the base name of either a path value x or a string x, depending on which type is passed, and according to the following rules.
For a path value, the base name is considered to be the part of the path after the last directory separator, including any file extensions. This is the simple case, as path values don't have trailing slashes.
When the argument is a string, a more involved logic applies. If the string ends with a /
, only this one final slash is removed.
After this, the base name is returned as previously described, assuming /
as the directory separator. (Note that evaluation must be platform independent.)
This is somewhat similar to the GNU basename
command, but GNU basename
will strip any number of trailing slashes.
Noogle detected
baseNameOf :: String -> String
Implementation
This function is implemented in c++ and is part of the native nix runtime.