- Qbs Manual
- QbsProbes
- BinaryProbe
- Qbs 3.2.0

# BinaryProbe

Locates executable files outside the project. More...

Inherits: | PathProbe

- List of all members, including inherited members
- BinaryProbe is part of List of All Items.

## Detailed Description

Finds executable files that have the specified file names.

BinaryProbe searches for executable files within directories specified by the PATH environment variable.

Note: On Unix, also searches in the `/usr/bin` and `/usr/local/bin` directories by default. Override PathProbe.platformSearchPaths to change this behavior.

Note: On Windows, only files that have .com, .exe, .bat, .cmd extensions are considered executables. Override PathProbe.nameSuffixes to change this behavior.

For example, BinaryProbe can be used to search for a protobuf compiler executable as follows:

     // Assuming module is called "myproto"
     import qbs.File
     import qbs.Probes

     Module {
         // search for a protoc executable
         Probes.BinaryProbe {
             id: protocProbe
             names: "protoc"
         }
         property string executableFilePath: protocProbe.filePath

         validate: {
             if (!File.exists(executableFilePath))
                 throw "The executable '" + executableFilePath + "' does not exist.";
         }

         // use the found executable
         Rule {
             // rule input/outputs here...

             // run executable for the module called "myproto":
             prepare: {
                 var args = // initialize arguments...
                 var cmd = new Command(input.myproto.executableFilePath, args);
                 cmd.highlight = "codegen";
                 cmd.description = "generating protobuf files for " + input.fileName;
                 return [cmd];
             }
         }
     }