Function

NM-1.0NMutils_file_search_in_paths

  • Searches for a progname file in a list of search paths.

    Parameters

    • progname: string

      the helper program name, like "iptables" Must be a non-empty string, without path separator (/).

    • try_first: string

      a custom path to try first before searching. It is silently ignored if it is empty or not an absolute path.

    • paths: string

      a null terminated list of search paths. Can be empty or null, in which case only try_first is checked.

    • file_test_flags: FileTest

      the flags passed to g_file_test() when searching for progname. Set it to 0 to skip the g_file_test().

    • predicate: UtilsFileSearchInPathsPredicate

      if given, pass the file name to this function for additional checks. This check is performed after the check for file_test_flags. You cannot omit both file_test_flags and predicate.

    Returns string

    the full path to the helper, if found, or null if not found. The returned string is not owned by the caller, but later invocations of the function might overwrite it.