]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | // Copyright (c) 2006, 2007 Julio M. Merino Vidal |
2 | // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling | |
3 | // Copyright (c) 2009 Boris Schaeling | |
4 | // Copyright (c) 2010 Felipe Tanus, Boris Schaeling | |
5 | // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling | |
6 | // | |
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
9 | ||
10 | /** | |
11 | * \file boost/process/search_path.hpp | |
12 | * | |
13 | * Defines a function to search for an executable in path. | |
14 | */ | |
15 | ||
16 | #ifndef BOOST_PROCESS_SEARCH_PATH_HPP | |
17 | #define BOOST_PROCESS_SEARCH_PATH_HPP | |
18 | ||
19 | #include <boost/process/detail/config.hpp> | |
20 | #include <boost/process/environment.hpp> | |
21 | ||
22 | #if defined(BOOST_POSIX_API) | |
23 | #include <boost/process/detail/posix/search_path.hpp> | |
24 | #elif defined(BOOST_WINDOWS_API) | |
25 | #include <boost/process/detail/windows/search_path.hpp> | |
26 | #endif | |
27 | ||
28 | ||
29 | namespace boost { namespace process { | |
30 | ||
31 | /** | |
32 | * Searches for an executable in path. | |
33 | * | |
34 | * filename must be a basename including the file extension. | |
35 | * It must not include any directory separators (like a slash). | |
36 | * On Windows the file extension may be omitted. The function | |
37 | * will then try the various file extensions for executables on | |
38 | * Windows to find filename. | |
39 | * | |
40 | * \param filename The base of the filename to find | |
41 | * | |
42 | * \param path the set of paths to search, defaults to the "PATH" environment variable. | |
43 | * | |
44 | * \returns the absolute path to the executable filename or an | |
45 | * empty string if filename isn't found | |
46 | */ | |
f51cf556 TL |
47 | inline boost::process::filesystem::path search_path(const boost::process::filesystem::path &filename, |
48 | const std::vector<boost::process::filesystem::path> path = ::boost::this_process::path()) | |
b32b8144 FG |
49 | { |
50 | return ::boost::process::detail::api::search_path(filename, path); | |
51 | } | |
52 | }} | |
53 | ||
54 | #endif |