Logo Search packages:      
Sourcecode: ardour version File versions  Download package

std::string Glib::find_program_in_path ( const std::string &  program  ) 

Locates the first executable named program in the user's path, in the same way that execvp() would locate it. Returns a string with the absolute path name, or "" if the program is not found in the path. If program is already an absolute path, returns a copy of program if program exists and is executable, and "" otherwise.

On Windows, if program does not have a file type suffix, tries to append the suffixes in the PATHEXT environment variable (if that doesn't exist, the suffixes .com, .exe, and .bat) in turn, and then look for the resulting file name in the same way as CreateProcess() would. This means first in the directory where the program was loaded from, then in the current directory, then in the Windows 32-bit system directory, then in the Windows directory, and finally in the directories in the PATH environment variable. If the program is found, the return value contains the full name including the type suffix.

program A program name.
An absolute path, or "".

Definition at line 234 of file miscutils.cc.

  if(char *const buf = g_find_program_in_path(program.c_str()))
    return std::string(ScopedPtr<char>(buf).get());
    return std::string();

Generated by  Doxygen 1.6.0   Back to index