radarlib 1.4.6
Radar::FileSystem Class Reference

FileSystem class. More...

#include <radarlib/io.hpp>

Static Public Member Functions

static bool fileExists (const std::string &path)
 Check the existence of a file.
 
static bool dirExists (const std::string &path)
 Check the existence of a directory.
 
static void changeDir (const std::string &path)
 Change the current working directory.
 
static std::string getCurrentDir ()
 Get the current working directory.
 
static void mkDirTree (const std::string &path)
 Create a directory and all its parent directories if they don't exist If the directory already exists nothing is done.
 
static void rmDirTree (const std::string &path)
 Remove a directory and all its sub directories.
 
static void listFiles (std::vector< std::string > &result, const std::string &path, bool completePath=false)
 Get the list of all the files in a directory.
 
static void listDirs (std::vector< std::string > &result, const std::string &path, bool completePath=false)
 Get the list of all the direct sub directories of a specified directory.
 
static void createFile (const std::string &path)
 Touch a file like unix system command 'touch'.
 
static void createFile (const std::string &path, const std::string &msg)
 Touch a file like unix system command 'touch'.
 
static size_t getFileSize (const std::string &path)
 Get the size in bytes of the given file.
 

Detailed Description

FileSystem class.

This class provides functions to manipulate files and directories

Member Function Documentation

◆ fileExists()

static bool Radar::FileSystem::fileExists ( const std::string & path)
static

Check the existence of a file.

Parameters
paththe file path

◆ dirExists()

static bool Radar::FileSystem::dirExists ( const std::string & path)
static

Check the existence of a directory.

Parameters
paththe directory path

◆ changeDir()

static void Radar::FileSystem::changeDir ( const std::string & path)
static

Change the current working directory.

Parameters
paththe new directory path

◆ getCurrentDir()

static std::string Radar::FileSystem::getCurrentDir ( )
static

Get the current working directory.

◆ mkDirTree()

static void Radar::FileSystem::mkDirTree ( const std::string & path)
static

Create a directory and all its parent directories if they don't exist If the directory already exists nothing is done.

Parameters
paththe new directory path

◆ rmDirTree()

static void Radar::FileSystem::rmDirTree ( const std::string & path)
static

Remove a directory and all its sub directories.

Parameters
paththe directory path to remove

◆ listFiles()

static void Radar::FileSystem::listFiles ( std::vector< std::string > & result,
const std::string & path,
bool completePath = false )
static

Get the list of all the files in a directory.

Parameters
resultthe std::vector the will store the result paths
paththe parent directory to analize
completePathif true, the result paths will contain also the parent path specified

◆ listDirs()

static void Radar::FileSystem::listDirs ( std::vector< std::string > & result,
const std::string & path,
bool completePath = false )
static

Get the list of all the direct sub directories of a specified directory.

Parameters
resultthe std::vector the will store the result paths
paththe parent directory to analize
completePathif true, the result paths will contain also the parent path specified

◆ createFile() [1/2]

void Radar::FileSystem::createFile ( const std::string & path)
static

Touch a file like unix system command 'touch'.

Parameters
paththe path of the file

◆ createFile() [2/2]

void Radar::FileSystem::createFile ( const std::string & path,
const std::string & msg )
static

Touch a file like unix system command 'touch'.

Parameters
paththe path of the file
msga text to write into nthe file

◆ getFileSize()

static size_t Radar::FileSystem::getFileSize ( const std::string & path)
static

Get the size in bytes of the given file.

*

Parameters
paththe path of the file

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