Nix 2.26.3
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
4#include "file-system.hh"
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
39 static ExecutablePath load();
40
44 OsString render() const;
45
63 std::optional<std::filesystem::path> findName(
64 const OsString & exe,
65 std::function<bool(const std::filesystem::path &)> isExecutableFile = isExecutableFileAmbient) const;
66
74 std::filesystem::path findPath(
75 const std::filesystem::path & exe,
76 std::function<bool(const std::filesystem::path &)> isExecutable = isExecutableFileAmbient) const;
77
78 bool operator==(const ExecutablePath &) const = default;
79};
80
81} // namespace nix
std::basic_string< OsChar > OsString
Definition os-string.hh:32
char OsChar
Definition os-string.hh:17
Definition executable-path.hh:15
std::filesystem::path findPath(const std::filesystem::path &exe, std::function< bool(const std::filesystem::path &)> isExecutable=isExecutableFileAmbient) const
Definition executable-path.cc:82
static ExecutablePath load()
Definition executable-path.cc:18
OsString render() const
Definition executable-path.cc:56
static ExecutablePath parse(const OsString &path)
Definition executable-path.cc:26
std::optional< std::filesystem::path > findName(const OsString &exe, std::function< bool(const std::filesystem::path &)> isExecutableFile=isExecutableFileAmbient) const
Definition executable-path.cc:66