File indexing completed on 2025-01-18 09:50:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_PROCESS_v2_START_DIR_HPP
0011 #define BOOST_PROCESS_v2_START_DIR_HPP
0012
0013 #include <boost/process/v2/detail/config.hpp>
0014 #include <boost/process/v2/detail/last_error.hpp>
0015 #include <boost/process/v2/default_launcher.hpp>
0016
0017 BOOST_PROCESS_V2_BEGIN_NAMESPACE
0018
0019
0020 struct process_start_dir
0021 {
0022 filesystem::path start_dir;
0023
0024 process_start_dir(filesystem::path start_dir) : start_dir(std::move(start_dir))
0025 {
0026 }
0027
0028 #if defined(BOOST_PROCESS_V2_WINDOWS)
0029 error_code on_setup(windows::default_launcher & launcher,
0030 const filesystem::path &, const std::wstring &)
0031 {
0032 launcher.current_directory = start_dir;
0033 return error_code {};
0034 };
0035
0036 #else
0037 error_code on_exec_setup(posix::default_launcher & launcher,
0038 const filesystem::path &, const char * const *)
0039 {
0040 if (::chdir(start_dir.c_str()) == -1)
0041 return detail::get_last_error();
0042 else
0043 return error_code ();
0044 }
0045 #endif
0046
0047 };
0048
0049 BOOST_PROCESS_V2_END_NAMESPACE
0050
0051 #endif