libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
Ship::FolderManager Class Reference

Thin Objective-C++ bridge for locating macOS standard directories. More...

#include <AppleFolderManager.h>

Public Member Functions

 FolderManager ()
 Creates the internal NSAutoreleasePool.
 
 ~FolderManager ()
 
void CreateAppSupportDirectory (const char *appName)
 Creates the Application Support sub-directory for appName if it does not already exist.
 
const char * getMainBundlePath ()
 Returns the path to the application's main bundle directory.
 
const char * pathForDirectory (SearchPathDirectory directory, SearchPathDomainMask domainMask)
 Returns the first path for the given directory and domain mask.
 
const char * pathForDirectoryAppropriateForItemAtPath (SearchPathDirectory directory, SearchPathDomainMask domainMask, const char *itemPath, bool create=false)
 Returns a path appropriate for storing a file at itemPath.
 

Detailed Description

Thin Objective-C++ bridge for locating macOS standard directories.

FolderManager wraps a hidden NSAutoreleasePool and delegates to NSSearchPathForDirectoriesInDomains() so that C++ code can locate standard directories (Application Support, Caches, main bundle, etc.) without including Objective-C headers directly.

This class is only available on Apple platforms.

Constructor & Destructor Documentation

◆ FolderManager()

Ship::FolderManager::FolderManager ( )

Creates the internal NSAutoreleasePool.

◆ ~FolderManager()

Ship::FolderManager::~FolderManager ( )

Member Function Documentation

◆ CreateAppSupportDirectory()

void Ship::FolderManager::CreateAppSupportDirectory ( const char *  appName)

Creates the Application Support sub-directory for appName if it does not already exist.

Parameters
appNameApplication name used as the sub-directory name inside Application Support.

◆ getMainBundlePath()

const char * Ship::FolderManager::getMainBundlePath ( )

Returns the path to the application's main bundle directory.

Returns
Null-terminated UTF-8 path (valid for the lifetime of this FolderManager).

◆ pathForDirectory()

const char * Ship::FolderManager::pathForDirectory ( SearchPathDirectory  directory,
SearchPathDomainMask  domainMask 
)

Returns the first path for the given directory and domain mask.

Parameters
directoryStandard directory constant (e.g. NSApplicationSupportDirectory).
domainMaskDomain(s) to search (e.g. NSUserDomainMask).
Returns
Null-terminated UTF-8 path, or nullptr on failure.

◆ pathForDirectoryAppropriateForItemAtPath()

const char * Ship::FolderManager::pathForDirectoryAppropriateForItemAtPath ( SearchPathDirectory  directory,
SearchPathDomainMask  domainMask,
const char *  itemPath,
bool  create = false 
)

Returns a path appropriate for storing a file at itemPath.

Optionally creates the returned directory if create is true.

Parameters
directoryStandard directory constant.
domainMaskDomain(s) to search.
itemPathPath of the item to be stored (used as a hint).
createIf true, the directory is created before the path is returned.
Returns
Null-terminated UTF-8 path, or nullptr on failure.

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