2
0
mirror of https://github.com/boostorg/process.git synced 2026-01-19 04:22:15 +00:00

ec fix for search_path with std::filesystem.

closes #287.
This commit is contained in:
Klemens
2022-12-24 11:17:00 +08:00
committed by Klemens Morgenstern
parent d7df60938e
commit dc915be11d
2 changed files with 8 additions and 0 deletions

View File

@@ -27,7 +27,11 @@ inline boost::process::filesystem::path search_path(
for (const boost::process::filesystem::path & pp : path)
{
auto p = pp / filename;
#if defined(BOOST_PROCESS_USE_STD_FS)
std::error_code ec;
#else
boost::system::error_code ec;
#endif
bool file = boost::process::filesystem::is_regular_file(p, ec);
if (!ec && file && ::access(p.c_str(), X_OK) == 0)
return p;

View File

@@ -63,7 +63,11 @@ inline boost::process::filesystem::path search_path(
{
boost::process::filesystem::path pp_ext = p;
pp_ext += ext;
#if defined(BOOST_PROCESS_USE_STD_FS)
std::error_code ec;
#else
boost::system::error_code ec;
#endif
bool file = boost::process::filesystem::is_regular_file(pp_ext, ec);
if (!ec && file &&
::boost::winapi::sh_get_file_info(pp_ext.native().c_str(), 0, 0, 0, ::boost::winapi::SHGFI_EXETYPE_))