mirror of
https://github.com/NixOS/nix
synced 2025-07-01 04:18:00 +02:00
More support for std::filepath
in libnixutil
We're not replacing `Path` in exposed definitions in many cases, but just adding alternatives. This will allow us to "top down" change `Path` to `std::fileysystem::path`, and then we can remove the `Path`-using utilities which will become unused. Also add some test files which we forgot to include in the libutil unit tests `meson.build`. Co-Authored-By: siddhantCodes <siddhantk232@gmail.com>
This commit is contained in:
parent
dbabfc92d4
commit
a97a08411c
37 changed files with 258 additions and 120 deletions
|
@ -113,6 +113,16 @@ protected:
|
|||
, arity(1)
|
||||
{ }
|
||||
|
||||
Handler(std::filesystem::path * dest)
|
||||
: fun([dest](std::vector<std::string> ss) { *dest = ss[0]; })
|
||||
, arity(1)
|
||||
{ }
|
||||
|
||||
Handler(std::optional<std::filesystem::path> * dest)
|
||||
: fun([dest](std::vector<std::string> ss) { *dest = ss[0]; })
|
||||
, arity(1)
|
||||
{ }
|
||||
|
||||
template<class T>
|
||||
Handler(T * dest, const T & val)
|
||||
: fun([dest, val](std::vector<std::string> ss) { *dest = val; })
|
||||
|
@ -283,6 +293,18 @@ public:
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Expect a path argument.
|
||||
*/
|
||||
void expectArg(const std::string & label, std::filesystem::path * dest, bool optional = false)
|
||||
{
|
||||
expectArgs({
|
||||
.label = label,
|
||||
.optional = optional,
|
||||
.handler = {dest}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Expect 0 or more arguments.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue