blob: 4988a12f4a4f02396a8b275679227ca45ef77b98 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/*
* This source code is released into the public domain.
*/
module;
#include <filesystem>
#include <optional>
export module nihil.posix:find_in_path;
import nihil.error;
import :fd;
namespace nihil {
/*
* Find an executable in $PATH and return the full path. If $PATH is not set, uses _PATH_DEFPATH.
* If the file can't be found or opened, returns std::nullopt.
*/
export [[nodiscard]] auto find_in_path(std::filesystem::path const &file)
-> std::optional<std::filesystem::path>;
} // namespace nihil
|