qi.path is a set of functions to find binaries, libraries, data and configuration files on the system.
qi.path.findBin(name) → string¶| Parameters: |
|
|---|---|
| Returns: | the complete, native path to the file found. An empty string otherwise. |
Look for a binary in the system.
qi.path.findLib(name) → string¶| Parameters: | name – string. The full name of the library, or just the name. |
|---|---|
| Returns: | the complete, native path to the file found. An empty string otherwise. |
Look for a library in the system.
qi.path.findConf(application, file) → string¶| Parameters: |
|
|---|---|
| Returns: | the complete, native path to the file found. An empty string otherwise. |
Look for a configuration file in the system.
qi.path.findData(application, file) → string¶| Parameters: |
|
|---|---|
| Returns: | the complete, native path to the file found. An empty string otherwise. |
Look for a file in all dataPaths(application) directories. Return the first match.
qi.path.listData(application, pattern) → [string]¶| Parameters: |
|
|---|---|
| Returns: | a list of the complete, native paths of the files that matched. |
List data files matching the given pattern in all dataPaths(application) directories. For each match, return the occurence from the first dataPaths prefix. Directories are discarded.
qi.path.confPaths(application) → [string]¶| Parameters: | application – string. Name of the application. “” by default. |
|---|---|
| Returns: | The list of configuration directories. |
Get the list of directories used when searching for configuration files for the given application.
Warning
You should not assume those directories exist, nor that they are writable.
qi.path.dataPaths(application) → [string]¶| Parameters: | application – string. Name of the application. “” by default. |
|---|---|
| Returns: | The list of data directories. |
Get the list of directories used when searching for configuration files for the given application.
Warning
You should not assume those directories exist, nor that they are writable.
qi.path.binPaths() → [string]¶| Returns: | The list of directories used when searching for binaries. |
|---|
Warning
You should not assume those directories exist, nor that they are writable.
qi.path.libPaths() → [string]¶| Returns: | The list of directories used when searching for libraries. |
|---|
Warning
You should not assume those directories exist, nor that they are writable.
qi.path.setWritablePath(path) → None¶| Parameters: | path – string. A path on the system. |
|---|
Set the writable files path for users. Use an empty path to reset it to its initial value.
qi.path.userWritableDataPath(application, file) → string¶| Parameters: |
|
|---|---|
| Returns: | The file path. |
Get the writable data files path for users.
qi.path.userWritableConfPath(application, file) → string¶| Parameters: |
|
|---|---|
| Returns: | The file path. |
Get the writable configuration files path for users.
qi.path.sdkPrefix() → string¶| Returns: | The SDK prefix path. It is always a complete, native path. |
|---|
qi.path.sdkPrefixes() → list¶| Returns: | The list of sdk prefix. |
|---|
List of SDK prefix.
qi.path.addOptionalSdkPrefix(path)¶| Param: | an sdk prefix. |
|---|
add a new SDK path.
qi.path.clearOptionalSdkPrefix()¶Clear all optional sdk prefix.
Some qi.path functions take the name of a library or a binary as a parameter.
Full name of the library means you will include the OS specific extensions in your name.
For example, libopencv_objdetect.so .
Just the name means that you can just have the simple name of the library you want,
and do not need to worry about its extension.
For example, opencv_objdetect .
import qi
#where should I write the files for my application "myapp"?
dataPath = qi.path.userWritableDataPath("myapp", "mydatafile")
# datapath => /home/nao/.local/share/myapp/mydatafile
confPath = qi.path.userWritableConfPath("myapp", "myconffile")
# confPath => /home/nao/.config/myapp/myconffile
# I want to save all my data and configuration files in a personal folder
qi.path.setWritablePath("/home/nao/my_path")
dataPath = qi.path.userWritableDataPath("myapp", "mydatafile")
# datapath => /home/nao/my_path/data/myapp/mydatafile
confPath = qi.path.userWritableConfPath("myapp", "myconffile")
# confPath => /home/nao/my_path/config/myapp/myconffile