mirror of
https://github.com/NixOS/nix
synced 2025-07-06 17:31:47 +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
|
@ -11,21 +11,30 @@ namespace nix {
|
|||
* Named because it is similar to the Rust type, except it is in the
|
||||
* native encoding not WTF-8.
|
||||
*
|
||||
* Same as `std::filesystem::path::string_type`, but manually defined to
|
||||
* Same as `std::filesystem::path::value_type`, but manually defined to
|
||||
* avoid including a much more complex header.
|
||||
*/
|
||||
using OsString = std::basic_string<
|
||||
using OsChar =
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
wchar_t
|
||||
#else
|
||||
char
|
||||
#endif
|
||||
>;
|
||||
;
|
||||
|
||||
/**
|
||||
* Named because it is similar to the Rust type, except it is in the
|
||||
* native encoding not WTF-8.
|
||||
*
|
||||
* Same as `std::filesystem::path::string_type`, but manually defined
|
||||
* for the same reason as `OsChar`.
|
||||
*/
|
||||
using OsString = std::basic_string<OsChar>;
|
||||
|
||||
/**
|
||||
* `std::string_view` counterpart for `OsString`.
|
||||
*/
|
||||
using OsStringView = std::basic_string_view<OsString::value_type>;
|
||||
using OsStringView = std::basic_string_view<OsChar>;
|
||||
|
||||
std::string os_string_to_string(OsStringView path);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue