Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
executable-path.hh
Go to the documentation of this file.
1#pragma once
3
5
6namespace nix {
7
8MakeError(ExecutableLookupError, Error);
9
15{
16 std::vector<std::filesystem::path> directories;
17
18 constexpr static const OsChar separator =
19#ifdef WIN32
20 L';'
21#else
22 ':'
23#endif
24 ;
25
34 static ExecutablePath parse(const OsString & path);
35
40 void parseAppend(const OsString & path);
41
45 static ExecutablePath load();
46
50 OsString render() const;
51
69 std::optional<std::filesystem::path> findName(
70 const OsString & exe,
71 std::function<bool(const std::filesystem::path &)> isExecutableFile = isExecutableFileAmbient) const;
72
80 std::filesystem::path findPath(
81 const std::filesystem::path & exe,
82 std::function<bool(const std::filesystem::path &)> isExecutable = isExecutableFileAmbient) const;
83
84 bool operator==(const ExecutablePath &) const = default;
85};
86
87} // namespace nix
Definition error.hh:310
Utilities for working with the file system and file paths.
char OsChar
Definition os-string.hh:21
std::basic_string< OsChar > OsString
Definition os-string.hh:36
Definition executable-path.hh:15
void parseAppend(const OsString &path)
Definition executable-path.cc:30
static ExecutablePath load()
Definition executable-path.cc:15
OsString render() const
Definition executable-path.cc:57
static ExecutablePath parse(const OsString &path)
Definition executable-path.cc:23
std::filesystem::path findPath(const std::filesystem::path &exe, std::function< bool(const std::filesystem::path &)> isExecutable=isExecutableFileAmbient) const
Definition executable-path.cc:83
std::optional< std::filesystem::path > findName(const OsString &exe, std::function< bool(const std::filesystem::path &)> isExecutableFile=isExecutableFileAmbient) const
Definition executable-path.cc:67