File indexing completed on 2025-01-18 09:50:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_PROCESS_WINDOWS_SHELL_PATH_HPP
0011 #define BOOST_PROCESS_WINDOWS_SHELL_PATH_HPP
0012
0013 #include <boost/process/detail/config.hpp>
0014 #include <system_error>
0015 #include <boost/process/filesystem.hpp>
0016 #include <boost/winapi/basic_types.hpp>
0017 #include <boost/winapi/get_system_directory.hpp>
0018
0019 namespace boost { namespace process { namespace detail { namespace windows {
0020
0021 inline boost::process::filesystem::path shell_path()
0022 {
0023 ::boost::winapi::WCHAR_ sysdir[260];
0024 unsigned int size = ::boost::winapi::get_system_directory(sysdir, sizeof(sysdir));
0025 if (!size)
0026 throw_last_error("GetSystemDirectory() failed");
0027
0028 boost::process::filesystem::path p = sysdir;
0029 return p / "cmd.exe";
0030 }
0031
0032 inline boost::process::filesystem::path shell_path(std::error_code &ec) noexcept
0033 {
0034
0035 ::boost::winapi::WCHAR_ sysdir[260];
0036 unsigned int size = ::boost::winapi::get_system_directory(sysdir, sizeof(sysdir));
0037 boost::process::filesystem::path p;
0038 if (!size)
0039 ec = std::error_code(
0040 ::boost::winapi::GetLastError(),
0041 std::system_category());
0042 else
0043 {
0044 ec.clear();
0045 p = sysdir;
0046 p /= "cmd.exe";
0047 }
0048 return p;
0049 }
0050
0051 }}}}
0052
0053 #endif