PrevUpHomeNext

Function search_path

boost::process::search_path

Synopsis

// In header: <boost/process/search_path.hpp>


string_type search_path(const string_type & filename, string_type path = "");

Description

Searches for an executable in path.

filename must be a basename including the file extension. It must not include any directory separators (like a slash). On Windows the file extension may be omitted. The function will then try the various file extensions for executables on Windows to find filename.

path must be a set of directories. Directories must be separated by colons on POSIX and by semicolons on Windows. If path is empty, the environment variable PATH is used.

Returns:

the absolute path to the executable filename or an empty string if filename isn't found

Throws:

std::runtime_error if path is empty and no environment variable PATH exists

PrevUpHomeNext