search_path.hpp
Go to the documentation of this file.
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#pragma once
17
19
20#include BOOST_PROCESS_PLATFORM_PROMOTE_PATH(search_path)
21BOOST_PROCESS_PLATFORM_PROMOTE_NAMESPACE(search_path)
22
23#if defined(BOOST_PROCESS_DOXYGEN)
24namespace boost
25{
26 namespace process
27 {
28
29 /**
30 * Searches for an executable in path.
31 *
32 * filename must be a basename including the file extension.
33 * It must not include any directory separators (like a slash).
34 * On Windows the file extension may be omitted. The function
35 * will then try the various file extensions for executables on
36 * Windows to find filename.
37 *
38 * path must be a set of directories. Directories must be
39 * separated by colons on POSIX and by semicolons on Windows.
40 * If path is empty, the environment variable PATH is used.
41 *
42 * \returns the absolute path to the executable filename or an
43 * empty string if filename isn't found
44 *
45 * \throws std::runtime_error if path is empty and no environment
46 * variable PATH exists
47 */
48 string_type search_path(const string_type& filename, string_type path = "");
49
50 } // namespace process
51} // namespace boost
52#endif
Defines various macros.
std::string search_path(const std::string &filename, std::string path="")