From a8b0ea58e60bb0326b7f7c8f3c736d89ce9ef1df Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Sun, 29 Jun 2025 19:19:23 +0100 Subject: wip macOS port --- nihil.posix/find_in_path.ccm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 nihil.posix/find_in_path.ccm (limited to 'nihil.posix/find_in_path.ccm') diff --git a/nihil.posix/find_in_path.ccm b/nihil.posix/find_in_path.ccm new file mode 100644 index 0000000..4988a12 --- /dev/null +++ b/nihil.posix/find_in_path.ccm @@ -0,0 +1,24 @@ +/* + * This source code is released into the public domain. + */ + +module; + +#include +#include + +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; + +} // namespace nihil -- cgit v1.2.3