TGUI  0.9.5
Loading...
Searching...
No Matches
tgui::Filesystem Class Reference

Helper functionality for filesystem access. More...

#include <TGUI/Filesystem.hpp>

Classes

struct  FileInfo
 Information about a file or directory, used to return data from the listFilesInDirectory function. More...
 
class  Path
 Object to represent paths on a filesystem. More...
 

Static Public Member Functions

static bool directoryExists (const Path &path)
 Checks if a directory exists.
 
static bool directoryExists (const String &path)
 Checks if a directory exists.
 
static bool fileExists (const Path &path)
 Checks if a file exists.
 
static bool fileExists (const String &path)
 Checks if a file exists.
 
static bool createDirectory (const Path &path)
 Create a directory.
 
static bool createDirectory (const String &path)
 Create a directory.
 
static Path getHomeDirectory ()
 Returns the home directory.
 
static Path getCurrentWorkingDirectory ()
 Returns the current working directory.
 
static Path getLocalDataDirectory ()
 Returns the directory to store application data.
 
static std::vector< FileInfolistFilesInDirectory (const Path &path)
 Returns a list of all files and folders inside a given directory.
 

Detailed Description

Helper functionality for filesystem access.

When TGUI is built with c++17 support then std::filesystem is used on newer compilers. Otherwise, POSIX or Windows-specific code is used to implement the functionality.

Member Function Documentation

◆ createDirectory() [1/2]

static bool tgui::Filesystem::createDirectory ( const Path path)
static

Create a directory.

Parameters
pathPath to the directory to create
Returns
True if the directory was created or already existed, false on failure.

This function will fail if the parent directory doesn't exist. It won't try to recursively create the directory.

◆ createDirectory() [2/2]

static bool tgui::Filesystem::createDirectory ( const String path)
inlinestatic

Create a directory.

Parameters
pathPath to the directory to create
Returns
True if the directory was created or already existed, false on failure.

This function will fail if the parent directory doesn't exist. It won't try to recursively create the directory.

◆ directoryExists() [1/2]

static bool tgui::Filesystem::directoryExists ( const Path path)
static

Checks if a directory exists.

Parameters
pathPath to the directory to check
Returns
True if the directory exists, false otherwise

◆ directoryExists() [2/2]

static bool tgui::Filesystem::directoryExists ( const String path)
inlinestatic

Checks if a directory exists.

Parameters
pathPath to the directory to check
Returns
True if the directory exists, false otherwise

◆ fileExists() [1/2]

static bool tgui::Filesystem::fileExists ( const Path path)
static

Checks if a file exists.

Parameters
pathPath to the file to check
Returns
True if the file exists, false otherwise

◆ fileExists() [2/2]

static bool tgui::Filesystem::fileExists ( const String path)
inlinestatic

Checks if a file exists.

Parameters
pathPath to the file to check
Returns
True if the file exists, false otherwise

◆ getCurrentWorkingDirectory()

static Path tgui::Filesystem::getCurrentWorkingDirectory ( )
static

Returns the current working directory.

Returns
Path to the current working directory

◆ getHomeDirectory()

static Path tgui::Filesystem::getHomeDirectory ( )
static

Returns the home directory.

Returns
Path to the home directory

◆ getLocalDataDirectory()

static Path tgui::Filesystem::getLocalDataDirectory ( )
static

Returns the directory to store application data.

Returns
Path to local app data directory

On Windows, this returns the value of LOCALAPPDATA% On macOS, this returns $HOME/Library/Application Support On Linux and other platforms, this returns $HOME/.local/share

◆ listFilesInDirectory()

static std::vector< FileInfo > tgui::Filesystem::listFilesInDirectory ( const Path path)
static

Returns a list of all files and folders inside a given directory.

Parameters
pathPath in which all directories and files should be listed
Returns
List of files (including directories) that are found within the given path

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