|
std::string | sdkPrefix () |
| Return the default SDK prefix path. More...
|
|
std::string | findBin (const std::string &name) |
| Look for a binary. More...
|
|
std::string | findLib (const std::string &name) |
| Look for a library. More...
|
|
std::string | findConf (const std::string &applicationName, const std::string &filename) |
| Look for a configuration file. More...
|
|
std::string | findData (const std::string &applicationName, const std::string &filename) |
|
std::vector< std::string > | listData (const std::string &applicationName, const std::string &pattern="*") |
|
std::vector< std::string > | confPaths (const std::string &applicationName="") |
| Get the list of directories used when searching for configuration files for the given application name. More...
|
|
std::vector< std::string > | dataPaths (const std::string &applicationName="") |
| Get the list of directories used when searching for data files for the given application name. More...
|
|
std::vector< std::string > | binPaths () |
| Get the list of directories used when searching for binaries. More...
|
|
std::vector< std::string > | libPaths () |
| Get the list of directories used when searching for libraries. More...
|
|
void | setWritablePath (const std::string &path) |
| Set the writable files path for users. More...
|
|
std::string | userWritableDataPath (const std::string &applicationName, const std::string &filename) |
| Get the writable data files path for users. More...
|
|
std::string | userWritableConfPath (const std::string &applicationName, const std::string &filename="") |
| Get the writable configuration files path for users. More...
|
|
std::string | convertToDosPath (const std::string &pathString) |
|
Set of tools to handle SDK layouts.
* .. note::
* Every string MUST be encoded in UTF-8. Every returned string are encoded in UTF-8.
*
std::string qi::path::convertToDosPath |
( |
const std::string & |
pathString | ) |
|
Convert given path into DOS 8.3 path if it exists, else returns empty string (Windows only). To use some API that doesn't support unicode on Windows, it is possible to convert a unicode path to an existing file into a DOS path without any accentuated characters. (for ex. "C:\test àé\" becomes "C:\TEST~1\" if it already exists)
On other platforms, simply return pathString.
qi::path::dataPaths |
( |
const std::string & |
applicationName = "" | ) |
|
Get the list of directories used when searching for data files for the given application name.
- Parameters
-
applicationName | Name of the application. |
- Returns
- A list of directories.
* This is used by the :cpp:func:`qi::path::findData(const std::string&, const std::string&)`
* and the :cpp:func:`qi::path::listData(const std::string&, const std::string&)`.
*
* The list of paths is constructed like this:
*
* - first, a standard path in the home directory (like
* ~/.local/share/<applicationName>/<filename>)
* - then <sdk_prefix>/share/<applicationName>/<filename> for each known SDK
* prefix.
*
* .. warning:: You should not assume those directories exist,
* nor that they are writeable.
*
qi::path::findData |
( |
const std::string & |
applicationName, |
|
|
const std::string & |
filename |
|
) |
| |
Look for a file in all dataPaths(applicationName) directories, return the first match.
- Parameters
-
applicationName | Name of the application. |
filename | Name of the file to look for. You can specify subdirectories using "/" as directory separator. |
- Returns
- The complete, native path of the file if it was found, an empty string otherwise.
* The file is searched in a list of possible directories, provided by the
* :cpp:func:`qi::path::dataPaths(const std::string&)`.
* The first match is returned.
*
* For instance if you have the following files on a unix system
*
* ~/.local/share/foo/models/nao.xml
* /usr/share/foo/models/nao.xml
*
* then listData("foo", "models/nao.xml") will return
*
* ~/.local/share/foo/models/nao.xml
*
qi::path::listData |
( |
const std::string & |
applicationName, |
|
|
const std::string & |
pattern = "*" |
|
) |
| |
List data files matching the given pattern in all dataPaths(applicationName) directories. For each match, return the occurence from the first dataPaths prefix. Directories are discarded.
- Parameters
-
applicationName | Name of the application. |
pattern | wilcard pattern of the files to look for. You can specify subdirectories using "/" as directory separator. |
- Returns
- An std::vector of the complete, native paths of the files that matched.
* Matches are searched in a list of possible directories, provided by the
* :cpp:func:`qi::path::dataPaths(const std::string&)`.
* When several matches collide, the first one is
* returned.
*
* For instance if you have the following files on a unix system
*
* ~/.local/share/foo/models/nao.xml
* ~/.local/share/foo/models/romeo_with_laser_head.xml
* /usr/share/foo/models/nao.xml
* /usr/share/foo/models/romeo.xml
*
* then listData("foo", "models/*.xml") will return
*
* ~/.local/share/foo/models/nao.xml
* ~/.local/share/foo/models/romeo_with_laser_head.xml
* /usr/share/foo/models/romeo.xml
*