Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:08

0001 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
0002 // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
0003 // Copyright (c) 2009 Boris Schaeling
0004 // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
0005 // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
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