SOFA API  014b24ea
Open source framework for multi-physics simuation
sofa::helper::system::SetDirectory Class Reference

#include <SetDirectory.h>

Public Attributes

std::string previousDir
 
std::string directory
 

Public Member Functions

 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. More...
 
static std::string GetCurrentDir ()
 Get the current directory. More...
 
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". More...
 
static std::string GetFileName (const char *filename)
 Get the filename from an absolute path description, i.e. if given"a/b/c", return "c". More...
 
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". More...
 
static std::string GetFileNameWithoutExtension (const char *filename)
 Get the filename from an absolute path description without extension i.e. if given"a/b/c.d", return "c". More...
 
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]. More...
 
static std::string GetRelativeFromDir (const char *filename, const char *basename)
 
static std::string GetRelativeFromFile (const char *filename, const char *basename)
 
static std::string GetRelativeFromProcess (const char *filename, const char *basename=nullptr)
 

Attribute details

std::string sofa::helper::system::SetDirectory::directory
std::string sofa::helper::system::SetDirectory::previousDir

Constructor details

sofa::helper::system::SetDirectory::SetDirectory ( const std::string &  filename)
sofa::helper::system::SetDirectory::~SetDirectory ( )

Function details

std::string sofa::helper::system::SetDirectory::GetCurrentDir ( )
static

Get the current directory.

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".

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".

std::string sofa::helper::system::SetDirectory::GetFileNameWithoutExtension ( const char *  filename)
static

Get the filename from an absolute path description without extension i.e. if given"a/b/c.d", return "c".

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".

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].

std::string sofa::helper::system::SetDirectory::GetRelativeFromDir ( const char *  filename,
const char *  basename 
)
static

Get the ABSOLUTE path of a file relative to a directory i.e. if given "../e" and "a/b/c", return "a/b/e".

std::string sofa::helper::system::SetDirectory::GetRelativeFromFile ( const char *  filename,
const char *  basename 
)
static

Get the ABSOLUTE path of a file relative to another file path i.e. if given "../e" and "a/b/c", return "a/e".

std::string sofa::helper::system::SetDirectory::GetRelativeFromProcess ( const char *  filename,
const char *  basename = nullptr 
)
static

Get the ABSOLUTE path of a file relative to current process path i.e. if given "../e" and "a/b/c", return "a/e".

bool sofa::helper::system::SetDirectory::IsAbsolute ( const std::string &  filename)
static

Return true if the given file has an absolute path.