#include <SetDirectory.h>

Public Member Functions | |
| SetDirectory (const char *filename) | |
| SetDirectory (const std::string &filename) | |
| ~SetDirectory () | |
Static Public Member Functions | |
| static bool | IsAbsolute (const std::string &filename) |
| Return true if the given file has an absolute path. | |
| static std::string | GetCurrentDir () |
| Get the current directory. | |
| static std::string | GetParentDir (const char *filename) |
| Get the parent directory of a given file, i.e. if given "a/b/c", return "a/b". | |
| static std::string | GetFileName (const char *filename) |
| Get the filename from an absolute path description, i.e. if given"a/b/c", return "c". | |
| static std::string | GetExtension (const char *filename) |
| Get the extension of a file from an absolute path description, i.e. if given"a/b/c.d", return "d". | |
| static std::string | GetProcessFullPath (const char *filename) |
| Get the full path of the current process. The given filename should be the value of argv[0]. | |
| static std::string | GetRelativeFromDir (const char *filename, const char *basename) |
| Get the file relative to a directory, i.e. if given "../e" and "a/b/c", return "a/b/e". | |
| static std::string | GetRelativeFromFile (const char *filename, const char *basename) |
| Get the file relative to another file path, i.e. if given "../e" and "a/b/c", return "a/e". | |
| static std::string | GetRelativeFromProcess (const char *filename, const char *basename=NULL) |
| Get the file relative to current process path, i.e. if given "../e" and "a/b/c", return "a/e". | |
Data Fields | |
| std::string | previousDir |
| std::string | directory |
Definition at line 42 of file SetDirectory.h.
| sofa::helper::system::SetDirectory::SetDirectory | ( | const char * | filename | ) |
Definition at line 51 of file SetDirectory.cpp.
References directory, GetCurrentDir(), GetParentDir(), and previousDir.
| sofa::helper::system::SetDirectory::SetDirectory | ( | const std::string & | filename | ) |
Definition at line 66 of file SetDirectory.cpp.
References directory, GetCurrentDir(), GetParentDir(), and previousDir.
| sofa::helper::system::SetDirectory::~SetDirectory | ( | ) |
| std::string sofa::helper::system::SetDirectory::GetCurrentDir | ( | ) | [static] |
Get the current directory.
Definition at line 106 of file SetDirectory.cpp.
Referenced by sofa::helper::system::FileRepository::findFile(), sofa::simulation::tree::xml::processXMLLoading(), and SetDirectory().
| std::string sofa::helper::system::SetDirectory::GetExtension | ( | const char * | filename | ) | [static] |
Get the extension of a file from an absolute path description, i.e. if given"a/b/c.d", return "d".
Definition at line 138 of file SetDirectory.cpp.
Referenced by sofa::simulation::tree::Simulation::load().
| std::string sofa::helper::system::SetDirectory::GetFileName | ( | const char * | filename | ) | [static] |
Get the filename from an absolute path description, i.e. if given"a/b/c", return "c".
Definition at line 128 of file SetDirectory.cpp.
Referenced by sofa::gui::qt::AddPreset::AddPreset(), sofa::gui::qt::SofaModeler::fileOpen(), sofa::gui::qt::SofaModeler::fileSaveAs(), sofa::gui::qt::RealGUI::setWriteSceneName(), and sofa::gui::qt::RealGUI::slot_recordSimulation().
| std::string sofa::helper::system::SetDirectory::GetParentDir | ( | const char * | filename | ) | [static] |
Get the parent directory of a given file, i.e. if given "a/b/c", return "a/b".
Definition at line 118 of file SetDirectory.cpp.
Referenced by sofa::gui::qt::SofaModeler::fileOpen(), sofa::gui::qt::RealGUI::fileOpenSimu(), sofa::gui::qt::SofaModeler::fileSaveAs(), sofa::helper::system::FileRepository::findFileFromFile(), GetRelativeFromDir(), GetRelativeFromFile(), SetDirectory(), sofa::gui::qt::RealGUI::setWriteSceneName(), and sofa::gui::qt::SofaModeler::SofaModeler().
| std::string sofa::helper::system::SetDirectory::GetProcessFullPath | ( | const char * | filename | ) | [static] |
Get the full path of the current process. The given filename should be the value of argv[0].
Definition at line 181 of file SetDirectory.cpp.
Referenced by GetRelativeFromProcess(), and sofa::gui::qt::RealGUI::init().
| std::string sofa::helper::system::SetDirectory::GetRelativeFromDir | ( | const char * | filename, | |
| const char * | basename | |||
| ) | [static] |
Get the file relative to a directory, i.e. if given "../e" and "a/b/c", return "a/b/e".
Definition at line 148 of file SetDirectory.cpp.
References GetParentDir(), and IsAbsolute().
Referenced by sofa::helper::system::FileRepository::findFile(), sofa::helper::system::FileRepository::findFileIn(), GetRelativeFromFile(), sofa::gui::qt::RealGUI::init(), and sofa::simulation::tree::xml::processXMLLoading().
| std::string sofa::helper::system::SetDirectory::GetRelativeFromFile | ( | const char * | filename, | |
| const char * | basename | |||
| ) | [static] |
Get the file relative to another file path, i.e. if given "../e" and "a/b/c", return "a/e".
Definition at line 168 of file SetDirectory.cpp.
References GetParentDir(), and GetRelativeFromDir().
Referenced by GetRelativeFromProcess(), and sofa::helper::io::MeshOBJ::readOBJ().
| std::string sofa::helper::system::SetDirectory::GetRelativeFromProcess | ( | const char * | filename, | |
| const char * | basename = NULL | |||
| ) | [static] |
Get the file relative to current process path, i.e. if given "../e" and "a/b/c", return "a/e".
Definition at line 174 of file SetDirectory.cpp.
References GetProcessFullPath(), and GetRelativeFromFile().
Referenced by sofa::helper::system::FileRepository::FileRepository().
| bool sofa::helper::system::SetDirectory::IsAbsolute | ( | const std::string & | filename | ) | [static] |
Return true if the given file has an absolute path.
Definition at line 95 of file SetDirectory.cpp.
Referenced by sofa::helper::system::FileRepository::findFile(), and GetRelativeFromDir().
| std::string sofa::helper::system::SetDirectory::directory |
| std::string sofa::helper::system::SetDirectory::previousDir |
1.5.7.1