MostlyHarmless 0.0.1
 
Loading...
Searching...
No Matches
mostly_harmless::utils::directories Namespace Reference

Contains filesystem helpers. More...

Enumerations

enum class  DirectoryType { Desktop , Documents , UserAppData , Temp }
 Represents a "special location type" on the user's system. More...
 

Functions

std::optional< std::filesystem::path > getDirectory (DirectoryType type)
 

Detailed Description

Contains filesystem helpers.

Enumeration Type Documentation

◆ DirectoryType

Represents a "special location type" on the user's system.

Enumerator
Desktop 

The user desktop directory - on macOS, ~/Desktop, on Windows, C:/Users/<You>/Desktop

Documents 

The user documents directory - on macOS, ~/Documents, on Windows, C:/Users/<You>/Documents

UserAppData 

The user application data directory - on macOS, ~/Library, on Windows, C:/Users/<You>/AppData

Temp 

The system temp directory.

Function Documentation

◆ getDirectory()

std::optional< std::filesystem::path > mostly_harmless::utils::directories::getDirectory ( DirectoryType type)
nodiscard

Attempts to retrieve the full path to a "special location" (to borrow JUCE's terminology) on the user's system.

Parameters
typeThe DirectoryType to search for
Returns
an optional containing the std::filesystem::path to the requested directory if successful, nullopt otherwise.