SOFA API  ca665544
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

◆ directory

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

◆ previousDir

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

Constructor details

◆ SetDirectory()

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

◆ ~SetDirectory()

sofa::helper::system::SetDirectory::~SetDirectory ( )

Function details

◆ GetCurrentDir()

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

Get the current directory.

◆ GetExtension()

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

◆ GetFileName()

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

◆ GetFileNameWithoutExtension()

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

◆ GetParentDir()

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

◆ GetProcessFullPath()

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

◆ GetRelativeFromDir()

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

◆ GetRelativeFromFile()

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

◆ GetRelativeFromProcess()

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

◆ IsAbsolute()

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

Return true if the given file has an absolute path.