Provides information about a file system entry. More...
#include <fileinfo.h>
Public Types | |
| using | Status = std::filesystem::file_status |
| File status type from the standard filesystem library. | |
Public Member Functions | |
| FileInfo (const String &filePath) | |
| Constructs a FileInfo for the given file path. | |
| FileInfo (const char *filePath) | |
| Constructs a FileInfo from a C string. | |
| FileInfo (const FilePath &fp) | |
| Constructs a FileInfo from a FilePath. | |
| FilePath | filePath () const |
| Returns the path as a FilePath. | |
| bool | exists () const |
| Returns true if the file or directory exists. | |
| String | fileName () const |
| Returns the filename component of the path (including extension). | |
| String | baseName () const |
| Returns the filename without its extension. | |
| String | suffix () const |
| Returns the file extension without the leading dot. | |
| String | absolutePath () const |
| Returns the absolute path of the parent directory. | |
| String | absoluteFilePath () const |
| Returns the absolute path to the file, including the filename. | |
| bool | isFile () const |
| Returns true if the path refers to a regular file. | |
| bool | isDirectory () const |
| Returns true if the path refers to a directory. | |
| void | updateStatus (bool force=false) const |
| Updates the cached file status. | |
| Status | status (bool forceUpdate=false) const |
| Returns the file status, updating the cache if needed. | |
| std::uintmax_t | size () const |
| Returns the file size in bytes. | |
| bool | isReadable () const |
| Returns true if the file is readable by the owner. | |
| bool | isWritable () const |
| Returns true if the file is writable by the owner. | |
| bool | isExecutable () const |
| Returns true if the file is executable by the owner. | |
Provides information about a file system entry.
Wraps std::filesystem to query file metadata such as existence, type, size, permissions, and path components. The file status is lazily
Constructs a FileInfo for the given file path.
| filePath | The path to the file or directory. |
Constructs a FileInfo from a C string.
| filePath | The path string. |
|
inline |
Returns the absolute path to the file, including the filename.
|
inline |
Returns the absolute path of the parent directory.
|
inline |
Returns the filename without its extension.
|
inline |
Returns true if the file or directory exists.
|
inline |
Returns the filename component of the path (including extension).
|
inline |
Returns true if the path refers to a directory.
|
inline |
Returns true if the file is executable by the owner.
|
inline |
Returns true if the path refers to a regular file.
|
inline |
Returns true if the file is readable by the owner.
|
inline |
Returns true if the file is writable by the owner.
|
inline |
Returns the file size in bytes.
Returns the file status, updating the cache if needed.
| forceUpdate | If true, forces a refresh of the cached status. |
|
inline |
Returns the file extension without the leading dot.
Updates the cached file status.
| force | If true, refreshes the status even if already cached. |