Functions to handle getting system paths, keeps track of:
More...
#include <ignition/common/SystemPaths.hh>
|
void std::function< std::string(const std::string &)> | _cb |
| Set the callback to use when ignition can't find a file. The callback should return a complete path to the requested file, or and empty string if the file was not found in the callback. More...
|
|
Functions to handle getting system paths, keeps track of:
- SystemPaths::pluginPaths - plugin library paths for common::WorldPlugin
◆ SystemPaths()
◆ ~SystemPaths()
◆ AddFilePaths()
Add colon (semicolon on windows) delimited paths to find files. These paths will be used with the FindFile function.
- Parameters
-
[in] | _path | A colon (semicolon on windows) delimited string of paths. |
◆ AddFindFileCallback()
Add a callback to use when FindFile() can't find a file. The callback should return a full local path to the requested file, or and empty string if the file was not found in the callback. Callbacks will be called in the order they were added until a path is found (if a callback is set using SetFindFileCallback(), that one is called first).
- Parameters
-
[in] | _cb | The callback function, which takes a file path or URI and returns the full local path. |
◆ AddFindFileURICallback()
Add a callback to use when FindFileURI() can't find a file. The callback should return a full local path to the requested file, or and empty string if the file was not found in the callback. Callbacks will be called in the order they were added until a path is found (if a callback is set using SetFindFileURICallback(), that one is called first).
- Parameters
-
[in] | _cb | The callback function, which takes a file path or URI and returns the full local path. |
◆ AddPluginPaths()
Add colon (semicolon on windows) delimited paths to plugins.
- Parameters
-
[in] | _path | the directory to add |
◆ AddSearchPathSuffix()
void AddSearchPathSuffix |
( |
const std::string & |
_suffix | ) |
|
add _suffix to the list of path search suffixes
- Parameters
-
[in] | _suffix | The suffix to add |
◆ ClearFilePaths()
clear out SystemPaths::filePaths
◆ ClearPluginPaths()
void ClearPluginPaths |
( |
| ) |
|
clear out SystemPaths::pluginPaths
◆ Delimiter()
static char Delimiter |
( |
| ) |
|
|
static |
Get the delimiter that the current operating system uses to separate different paths from each other.
◆ FilePaths()
Get the file paths.
- Returns
- a list of paths
◆ FindFile()
Find a file in the set search paths (not recursive)
- Parameters
-
[in] | _filename | Name of the file to find. |
[in] | _searchLocalPath | True to search in the current working directory. |
- Returns
- Returns full path name to file
◆ FindFileURI() [1/2]
Find a file or path using a URI.
- Parameters
-
[in] | _uri | the uniform resource identifier |
- Returns
- Returns full path name to file
◆ FindFileURI() [2/2]
Find a file or path using a URI.
- Parameters
-
[in] | _uri | the uniform resource identifier |
- Returns
- Returns full path name to file or an empty string if URI couldn't be found.
◆ FindSharedLibrary()
Find a shared library by name in the plugin paths.
This will try different combinations of library names on different platforms. For example searching for "MyLibName" may try finding "MyLibName", "libMyLibName.so", "MyLibName.dll", etc...
- Parameters
-
[in] | _libName | Name of shared libary to look for |
- Returns
- path to file or empty string on error
◆ LocateLocalFile()
look for a file in a set of search paths (not recursive) This method checks if a file exists in given directories. It does so by joining each path with the filename and checking if the file exists. If the file exists in multiple paths the first one is found.
- Parameters
-
[in] | _filename | Name of the file to find |
[in] | _paths | paths to look for the file |
- Returns
- Returns a path that will work from the current directory
◆ LogPath()
Get the log path.
- Returns
- the path
◆ NormalizeDirectoryPath()
Format the directory path to use "/" as a separator with "/" at the end.
- Parameters
-
[in] | _path | Path to normalize |
- Returns
- Normalized path
◆ PathsFromEnv()
Return all paths given by an environment variable.
- Parameters
-
[in] | _env | Environment variable. |
- Returns
- A list of paths listed by the environment variable.
◆ PluginPaths()
Get the plugin paths.
- Returns
- a list of paths
◆ SetFilePathEnv()
Set the file path environment variable to use, and clears any previously file paths. The default environment variable is IGN_FILE_PATH. The environment variable should be a set of colon (semicolon on windows) delimited paths. These paths will be used with the FindFile function.
- Parameters
-
[in] | _env | name of the environment variable |
◆ SetPluginPathEnv()
Set the plugin path environment variable to use.
- Parameters
-
[in] | _env | name of the environment variable |
◆ _cb
Set the callback to use when ignition can't find a file. The callback should return a complete path to the requested file, or and empty string if the file was not found in the callback.
Set the callback to use when ignition can't find a file uri. The callback should return a complete path to the requested file, or and empty string if the file was not found in the callback.
- Parameters
-
[in] | _cb | The callback function. |
- Deprecated:
- Use AddFindFileCallback instead
- Parameters
-
[in] | _cb | The callback function. |
- Deprecated:
- Use AddFindFileURICallback instead
The documentation for this class was generated from the following file: