File indexing completed on 2025-01-18 09:50:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_PROCESS_POSIX_SEARCH_PATH_HPP
0011 #define BOOST_PROCESS_POSIX_SEARCH_PATH_HPP
0012
0013 #include <boost/process/detail/config.hpp>
0014 #include <boost/process/filesystem.hpp>
0015 #include <boost/tokenizer.hpp>
0016 #include <string>
0017 #include <stdexcept>
0018 #include <stdlib.h>
0019 #include <unistd.h>
0020
0021 namespace boost { namespace process { namespace detail { namespace posix {
0022
0023 inline boost::process::filesystem::path search_path(
0024 const boost::process::filesystem::path &filename,
0025 const std::vector<boost::process::filesystem::path> &path)
0026 {
0027 for (const boost::process::filesystem::path & pp : path)
0028 {
0029 auto p = pp / filename;
0030 #if defined(BOOST_PROCESS_USE_STD_FS)
0031 std::error_code ec;
0032 #else
0033 boost::system::error_code ec;
0034 #endif
0035 bool file = boost::process::filesystem::is_regular_file(p, ec);
0036 if (!ec && file && ::access(p.c_str(), X_OK) == 0)
0037 return p;
0038 }
0039 return "";
0040 }
0041
0042 }}}}
0043
0044 #endif