18 #include <boost/array.hpp>
20 #include <boost/system/error_code.hpp>
21 #include <boost/tokenizer.hpp>
28 #if defined(_UNICODE) || defined(UNICODE)
34 path = ::_wgetenv(L
"PATH");
40 tokenizer<boost::char_separator<wchar_t>, std::wstring::const_iterator, std::wstring>
42 boost::char_separator<wchar_t> sep(L
";");
43 tokenizer tok(path, sep);
44 for (tokenizer::iterator it = tok.begin(); it != tok.end(); ++it)
46 std::filesystem::path p = *it;
48 boost::array<std::wstring, 4> extensions = {L
"", L
".exe", L
".com", L
".bat"};
49 for (boost::array<std::wstring, 4>::iterator it2 = extensions.begin();
50 it2 != extensions.end();
53 std::filesystem::path p2 = p;
55 boost::system::error_code ec;
56 bool file = std::filesystem::is_regular_file(p2, ec);
57 if (!ec && file && SHGetFileInfoW(p2.c_str(), 0, 0, 0, SHGFI_EXETYPE))
71 path = ::getenv(
"PATH");
76 using tokenizer = boost::tokenizer<boost::char_separator<char>>;
77 boost::char_separator<char> sep(
";");
78 tokenizer tok(path, sep);
79 for (tokenizer::iterator it = tok.begin(); it != tok.end(); ++it)
81 std::filesystem::path p = *it;
83 boost::array<std::string, 4> extensions = {
"",
".exe",
".com",
".bat"};
84 for (boost::array<std::string, 4>::iterator it2 = extensions.begin();
85 it2 != extensions.end();
88 std::filesystem::path p2 = p;
90 boost::system::error_code ec;
91 bool file = std::filesystem::is_regular_file(p2, ec);
92 if (!ec && file && SHGetFileInfoA(p2.string().c_str(), 0, 0, 0, SHGFI_EXETYPE))