mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 13:06:01 +01:00
Build a minimized Nix with MinGW
At this point many features are stripped out, but this works:
- Can run libnix{util,store,expr} unit tests
- Can run some Nix commands
Co-Authored-By volth <volth@volth.com>
Co-Authored-By Brian McKenna <brian@brianmckenna.org>
This commit is contained in:
parent
2248a3f545
commit
8433027e35
111 changed files with 1162 additions and 140 deletions
52
src/libutil/file-path.hh
Normal file
52
src/libutil/file-path.hh
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
#include <optional>
|
||||
#include <filesystem>
|
||||
|
||||
#include "types.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
/**
|
||||
* Paths are just `std::filesystem::path`s.
|
||||
*
|
||||
* @todo drop `NG` suffix and replace the ones in `types.hh`.
|
||||
*/
|
||||
typedef std::filesystem::path PathNG;
|
||||
typedef std::list<Path> PathsNG;
|
||||
typedef std::set<Path> PathSetNG;
|
||||
|
||||
/**
|
||||
* Stop gap until `std::filesystem::path_view` from P1030R6 exists in a
|
||||
* future C++ standard.
|
||||
*
|
||||
* @todo drop `NG` suffix and replace the one in `types.hh`.
|
||||
*/
|
||||
struct PathViewNG : std::basic_string_view<PathNG::value_type>
|
||||
{
|
||||
using string_view = std::basic_string_view<PathNG::value_type>;
|
||||
|
||||
using string_view::string_view;
|
||||
|
||||
PathViewNG(const PathNG & path)
|
||||
: std::basic_string_view<PathNG::value_type>(path.native())
|
||||
{ }
|
||||
|
||||
PathViewNG(const PathNG::string_type & path)
|
||||
: std::basic_string_view<PathNG::value_type>(path)
|
||||
{ }
|
||||
|
||||
const string_view & native() const { return *this; }
|
||||
string_view & native() { return *this; }
|
||||
};
|
||||
|
||||
std::string os_string_to_string(PathViewNG::string_view path);
|
||||
|
||||
PathNG::string_type string_to_os_string(std::string_view s);
|
||||
|
||||
std::optional<PathNG> maybePathNG(PathView path);
|
||||
|
||||
PathNG pathNG(PathView path);
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue