te::core::FileSystem Class Reference

A class for handling system files and paths using UTF-8 strings. More...

#include <FileSystem.h>

Static Public Member Functions

static std::string absolutePath (const std::string &path)
 Retrives the absolute path for the given path in UTF-8. More...
 
static void copyFile (const std::string &from, const std::string &to)
 Copies a file. More...
 
static bool createDirectories (const std::string &path)
 Creates a directory for any element of path that does not exist. More...
 
static bool createDirectory (const std::string &path)
 Creates a directory from a given path in UTF-8. More...
 
static std::string currentPath ()
 Retrives the current working directory path in UTF-8. More...
 
static std::string executableDirectory ()
 
static bool exists (const std::string &path)
 Checks if a given path in UTF-8 exists. More...
 
static std::string extension (const std::string &path)
 Retrives the extension of a given file path in UTF-8. More...
 
static bool isDirectory (const std::string &path)
 Checks if a given path in UTF-8 is a directory. More...
 
static bool isEmpty (const std::string &path)
 Checks if a given path in UTF-8 is an empty directory. More...
 
static bool isRegularFile (const std::string &path)
 Checks if a given path in UTF-8 is a regular file. More...
 
static std::vector< std::string > listDirectory (const std::string &path)
 Lists a directory from a given path in UTF-8. More...
 
static bool remove (const std::string &path)
 Removes a file or directory from a given path in UTF-8. More...
 
static void rename (const std::string &old_p, const std::string &new_p)
 Renames a file or directory from a given path in UTF-8. More...
 
static std::string systemCompletePath (const std::string &path)
 Composes an absolute path for the given path in UTF-8. More...
 
static std::string tempDirectoryPath ()
 Retrives the temp directory in UTF-8. More...
 
static std::string uniquePath (const std::string &format="%%%%-%%%%-%%%%-%%%%")
 Retrives an unique path generated by a given format. More...
 

Private Member Functions

 FileSystem ()
 
 FileSystem (FileSystem const &)
 
FileSystemoperator= (FileSystem const &)
 
 ~FileSystem ()
 

Detailed Description

A class for handling system files and paths using UTF-8 strings.

Definition at line 49 of file FileSystem.h.

Constructor & Destructor Documentation

te::core::FileSystem::FileSystem ( )
private
te::core::FileSystem::~FileSystem ( )
private
te::core::FileSystem::FileSystem ( FileSystem const &  )
private

Member Function Documentation

static std::string te::core::FileSystem::absolutePath ( const std::string &  path)
static

Retrives the absolute path for the given path in UTF-8.

Parameters
pathPath in UTF-8.
Returns
String in UTF-8 for the absolute path.
static void te::core::FileSystem::copyFile ( const std::string &  from,
const std::string &  to 
)
static

Copies a file.

Parameters
fromPath in UTF-8 for the file to be copied.
toPath in UTF-8 for the copy output.
static bool te::core::FileSystem::createDirectories ( const std::string &  path)
static

Creates a directory for any element of path that does not exist.

Parameters
pathPath in UTF-8.
Returns
true if a new directory was created, otherwise false.
static bool te::core::FileSystem::createDirectory ( const std::string &  path)
static

Creates a directory from a given path in UTF-8.

Parameters
pathPath in UTF-8.
Returns
true if a new directory was created, otherwise false.
static std::string te::core::FileSystem::currentPath ( )
static

Retrives the current working directory path in UTF-8.

Returns
String in UTF-8 for the current working directory path.
static std::string te::core::FileSystem::executableDirectory ( )
static
static bool te::core::FileSystem::exists ( const std::string &  path)
static

Checks if a given path in UTF-8 exists.

Parameters
pathPath in UTF-8.
Returns
true if exists, otherwise false.
static std::string te::core::FileSystem::extension ( const std::string &  path)
static

Retrives the extension of a given file path in UTF-8.

Parameters
pathFile path in UTF-8.
Returns
String in UTF-8 for the extension.
static bool te::core::FileSystem::isDirectory ( const std::string &  path)
static

Checks if a given path in UTF-8 is a directory.

Parameters
pathPath in UTF-8.
Returns
true if is a directory, otherwise false.
static bool te::core::FileSystem::isEmpty ( const std::string &  path)
static

Checks if a given path in UTF-8 is an empty directory.

Parameters
pathPath in UTF-8.
Returns
true if is a empty directory, otherwise false.
static bool te::core::FileSystem::isRegularFile ( const std::string &  path)
static

Checks if a given path in UTF-8 is a regular file.

Parameters
pathFile path in UTF-8.
Returns
true if is a regular file, otherwise false.

Referenced by te::common::ApplicationSettings::load().

static std::vector<std::string> te::core::FileSystem::listDirectory ( const std::string &  path)
static

Lists a directory from a given path in UTF-8.

Parameters
pathPath in UTF-8.
Returns
Vector of strings in UTF-8 for directory content.
FileSystem& te::core::FileSystem::operator= ( FileSystem const &  )
private
static bool te::core::FileSystem::remove ( const std::string &  path)
static

Removes a file or directory from a given path in UTF-8.

Note
This function will not remove if the directory is not empty.
Parameters
pathPath in UTF-8.
Returns
false if path did not exist in the first place, otherwise true.

Referenced by te::common::ApplicationSettings::update().

static void te::core::FileSystem::rename ( const std::string &  old_p,
const std::string &  new_p 
)
static

Renames a file or directory from a given path in UTF-8.

Parameters
old_pOld name in UTF-8.
new_pNew name in UTF-8.
static std::string te::core::FileSystem::systemCompletePath ( const std::string &  path)
static

Composes an absolute path for the given path in UTF-8.

Parameters
pathPath in UTF-8.
Returns
String in UTF-8 for the composed path.
static std::string te::core::FileSystem::tempDirectoryPath ( )
static

Retrives the temp directory in UTF-8.

Returns
String in UTF-8 for temp directory.
static std::string te::core::FileSystem::uniquePath ( const std::string &  format = "%%%%-%%%%-%%%%-%%%%")
static

Retrives an unique path generated by a given format.

Parameters
formatThe format used to create a unique path. e.g.: "%%%%-%%%%-%%%%-%%%%"
Returns
String in UTF-8 for the generated unique path.

Referenced by te::rp::Matrix< TemplateElementType >::createNewDiskFile().


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