##

SystemPaths Class Reference
Common

Functions to handle getting system paths, keeps track of: More...

`#include <common/common.hh>`

Inherits SingletonT< SystemPaths >.

## Public Member Functions

void | AddFindFileCallback (std::function< std::string(const std::string &)> _cb)
| Add a callback to use when Gazebo can't find a file. More...
void | AddGazeboPaths (const std::string &_path)
| Add colon delimited paths to Gazebo install. More...
void | AddModelPaths (const std::string &_path)
| Add colon delimited paths to modelPaths. More...
void | AddModelPathsUpdate (const std::string &_path)
| Add colon delimited paths to modelPaths and signal the update to InsertModelWidget. More...
void | AddOgrePaths (const std::string &_path)
| Add colon delimited paths to ogre install. More...
void | AddPluginPaths (const std::string &_path)
| Add colon delimited paths to plugins. More...
void | AddSearchPathSuffix (const std::string &_suffix)
| add _suffix to the list of path search suffixes More...
void | ClearGazeboPaths ()
| clear out SystemPaths::gazeboPaths More...
void | ClearModelPaths ()
| clear out SystemPaths::modelPaths More...
void | ClearOgrePaths ()
| clear out SystemPaths::ogrePaths More...
void | ClearPluginPaths ()
| clear out SystemPaths::pluginPaths More...
std::string | DefaultTestPath () const
| Returns the default temporary test path. More...
std::string | FindFile (const std::string &_filename, bool _searchLocalPath=true)
| Find a file in the gazebo paths. More...
std::string | FindFileURI (const std::string &_uri)
| Find a file or path using a URI. More...
const std::list< std::string > & | GetGazeboPaths ()
| Get the gazebo install paths. More...
std::string | GetLogPath () const
| Get the log path. More...
const std::list< std::string > & | GetModelPaths ()
| Get the model paths. More...
const std::list< std::string > & | GetOgrePaths ()
| Get the ogre install paths. More...
const std::list< std::string > & | GetPluginPaths ()
| Get the plugin paths. More...
std::string | GetWorldPathExtension ()
| Returns the world path extension. More...
const std::string & | TmpInstancePath () const
| Returns a unique temporary file for this instance of SystemPath. More...
const std::string & | TmpPath () const
| Returns the default path suitable for temporary files. More...

## Static Public Member Functions

static SystemPaths * | Instance ()
| Get an instance of the singleton. More...

## Public Attributes

bool | gazeboPathsFromEnv
| if true, call UpdateGazeboPaths() within GetGazeboPaths() More...
bool | modelPathsFromEnv
| if true, call UpdateGazeboPaths() within GetGazeboPaths() More...
bool | ogrePathsFromEnv
| if true, call UpdateOgrePaths() within GetOgrePaths() More...
bool | pluginPathsFromEnv
| if true, call UpdatePluginPaths() within GetPluginPaths() More...
event::EventT< void(std::string)> | updateModelRequest
| Event to notify InsertModelWidget that the model paths were changed. More...

## Detailed Description

Functions to handle getting system paths, keeps track of:

- SystemPaths::gazeboPaths - media paths containing worlds, models, sdf descriptions, material scripts, textures.
- SystemPaths::ogrePaths - ogre library paths. Should point to Ogre RenderSystem_GL.so et. al.
- SystemPaths::pluginPaths - plugin library paths for common::WorldPlugin

## Member Function Documentation

## AddFindFileCallback()

void AddFindFileCallback | ( | std::function< std::string(const std::string &)> | _cb | ) |

Add a callback to use when Gazebo 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.

Parameters

  [in] | _cb | The callback function, which takes a file path or URI and returns the full local path.

## AddGazeboPaths()

void AddGazeboPaths | ( | const std::string & | _path | ) |

Add colon delimited paths to Gazebo install.

Parameters

  [in] | _path | the directory to add

## AddModelPaths()

void AddModelPaths | ( | const std::string & | _path | ) |

Add colon delimited paths to modelPaths.

Parameters

  [in] | _path | the directory to add

## AddModelPathsUpdate()

void AddModelPathsUpdate | ( | const std::string & | _path | ) |

Add colon delimited paths to modelPaths and signal the update to InsertModelWidget.

Parameters

  [in] | _path | Path to be added to the current model path

## AddOgrePaths()

void AddOgrePaths | ( | const std::string & | _path | ) |

Add colon delimited paths to ogre install.

Parameters

  [in] | _path | the directory to add

## AddPluginPaths()

void AddPluginPaths | ( | const std::string & | _path | ) |

Add colon 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

## ClearGazeboPaths()

void ClearGazeboPaths | ( |  | ) |

clear out SystemPaths::gazeboPaths

## ClearModelPaths()

void ClearModelPaths | ( |  | ) |

clear out SystemPaths::modelPaths

## ClearOgrePaths()

void ClearOgrePaths | ( |  | ) |

clear out SystemPaths::ogrePaths

## ClearPluginPaths()

void ClearPluginPaths | ( |  | ) |

clear out SystemPaths::pluginPaths

## DefaultTestPath()

std::string DefaultTestPath | ( |  | ) | const

Returns the default temporary test path.

Returns
  a full path name to directory. E.g.: /tmp/gazebo_test (Linux).

## FindFile()

std::string FindFile | ( | const std::string & | _filename,
|  | bool | _searchLocalPath = `true`
| ) |  |

Find a file in the gazebo paths.

If not found locally, all callbacks added with AddFindFileCallback will be called in order until found.

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()

std::string FindFileURI | ( | const std::string & | _uri | ) |

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.

## GetGazeboPaths()

const std::list<std::string>& GetGazeboPaths | ( |  | ) |

Get the gazebo install paths.

Returns
  a list of paths

## GetLogPath()

std::string GetLogPath | ( |  | ) | const

Get the log path.

Returns
  the path

## GetModelPaths()

const std::list<std::string>& GetModelPaths | ( |  | ) |

Get the model paths.

Returns
  a list of paths

## GetOgrePaths()

const std::list<std::string>& GetOgrePaths | ( |  | ) |

Get the ogre install paths.

Returns
  a list of paths

## GetPluginPaths()

const std::list<std::string>& GetPluginPaths | ( |  | ) |

Get the plugin paths.

Returns
  a list of paths

## GetWorldPathExtension()

std::string GetWorldPathExtension | ( |  | ) |

Returns the world path extension.

Returns
  Right now, it just returns "/worlds"

## Instance()

static SystemPaths * Instance | ( |  | ) |

inline static inherited

Get an instance of the singleton.

## TmpInstancePath()

const std::string& TmpInstancePath | ( |  | ) | const

Returns a unique temporary file for this instance of SystemPath.

Returns
  a full path name to directory. E.g.: /tmp/gazebo_234123 (Linux).

## TmpPath()

const std::string& TmpPath | ( |  | ) | const

Returns the default path suitable for temporary files.

Returns
  a full path name to directory. E.g.: /tmp (Linux).

## Member Data Documentation

## gazeboPathsFromEnv

bool gazeboPathsFromEnv

if true, call UpdateGazeboPaths() within GetGazeboPaths()

## modelPathsFromEnv

bool modelPathsFromEnv

if true, call UpdateGazeboPaths() within GetGazeboPaths()

## ogrePathsFromEnv

bool ogrePathsFromEnv

if true, call UpdateOgrePaths() within GetOgrePaths()

## pluginPathsFromEnv

bool pluginPathsFromEnv

if true, call UpdatePluginPaths() within GetPluginPaths()

## updateModelRequest

event::EventT<void (std::string)> updateModelRequest

Event to notify InsertModelWidget that the model paths were changed.

The documentation for this class was generated from the following file:

- SystemPaths.hh