![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include <os-filename.hh>
Public Member Functions | |
| const std::filesystem::path & | path () const noexcept |
| const std::filesystem::path::value_type * | c_str () const noexcept |
| auto | operator<=> (const OsFilename &) const =default |
Static Public Member Functions | |
| static OsFilename | fromPathAsserting (std::filesystem::path p) |
| static OsFilename | fromPathThrowing (std::filesystem::path p) |
Friends | |
| class | OsCanonPath |
A newtype around std::filesystem::path that asserts at construction time that the path is a single filename component.
A valid OsFilename:
This type is useful for APIs that expect a bare filename rather than a full path, providing compile-time documentation and runtime validation.
|
inlinestatic |
Construct an OsFilename from a path, asserting that it is a single filename component.
Use this when we are witnessing an internal invariant / we as the programmer know the validation should pass. Fails with an assertion otherwise.
|
static |
Construct an OsFilename from a path, throwing an Error if it is not a single filename component.
Use this when the input comes from users / the external world, and we are not sure whether the invariant will pass.