Public Member Functions
-
~Platform ()
-
voidprepareLaunch ()
Called at the beginning of a launch, can be overridden for platform-specifc preparation.
-
voidcleanupLaunch ()
Called at the end of a launch, can be overridden for platform-specifc cleanup.
-
loadAsset (const fs::path &relativePath)
Returns a DataSourceRef to an application asset. Throws a AssetLoadExc on failure.
-
fs::pathgetAssetPath (const fs::path &relativePath) const
Returns a fs::path to an application asset. Returns an empty path on failure.
-
voidaddAssetDirectory (const fs::path &directory)
Adds an absolute path to the list of directories which are searched for assets.
Not thread-safe, e.g. you should not call this when loadAsset() or getAssetPath() can occur from a different thread.
-
const std::vector< fs::path > &getAssetDirectories () const
Returns a vector of directories that are searched when looking up an asset path.
-
loadResource (const fs::path &resourcePath)=0
Returns a DataSource to an application resource. resourcePath is defined on a per-platform basis.
- See Also
CinderResources
-
fs::pathgetResourceDirectory () const =0
Returns the absolute file path to the resources folder. Returns an empty fs::path on windows.
- See Also
CinderResources
-
fs::pathgetResourcePath (const fs::path &rsrcRelativePath) const =0
Returns the absolute file path to a resource located at rsrcRelativePath inside the bundle's resources folder. Returns an empty fs::path on windows. Throws ResourceLoadExc on failure.
- See Also
CinderResources
-
fs::pathgetExecutablePath () const
Returns the path to the associated executable.
-
voidsetExecutablePath (const fs::path &execPath)
Sets the path to the associated executable, overriding the default.
-
fs::pathgetOpenFilePath (const fs::path &initialPath=fs::path(), const std::vector< std::string > &extensions=std::vector< std::string >())=0
Presents the user with an open-file dialog and returns the selected file path. The dialog optionally begins at the path initialPath and can be limited to allow selection of files ending in the extensions enumerated in extensions .
the selected file path, or an empty fs::path if the user cancelled or this operation isn't supported on the current platform.
-
fs::pathgetFolderPath (const fs::path &initialPath=fs::path())=0
Presents the user with an open-folder dialog.
the selected file path, or an empty fs::path if the user cancelled or this operation isn't supported on the current platform.
-
fs::pathgetSaveFilePath (const fs::path &initialPath=fs::path(), const std::vector< std::string > &extensions=std::vector< std::string >())=0
Presents the user with a save-file dialog and returns the selected file path. The dialog optionally begins at the path initialPath and can be limited to allow selection of files ending in the extensions enumerated in extensions .
the selected file path, or an empty fs::path if the user cancelled or this operation isn't supported on the current platform.
-
std::ostream &console ()
Returns a reference to an output console, which is by default an alias to std::cout. Other platforms may override to use other necessary console mechanisms.
-
std::map< std::string, std::string >getEnvironmentVariables ()=0
Returns a std::map of the system's environment variables. Empty on WinRT.
-
fs::pathexpandPath (const fs::path &path)=0
Returns a canonical version of path . Collapses '.', ".." and "//". Converts '~' on Cocoa. Expands environment variables on MSW.
-
fs::pathgetHomeDirectory () const =0
Returns the path to the user's home directory.
-
fs::pathgetDocumentsDirectory () const =0
Returns the path to the user's documents directory.
-
fs::pathgetDefaultExecutablePath () const =0
Returns the path used for the default executable location. Users may override this with setExecutablePath() for application specific purposes.
-
voidsleep (float milliseconds)=0
Suspends the execution of the current thread until milliseconds have passed. Supports sub-millisecond precision only on OS X.
-
voidlaunchWebBrowser (const Url &url)=0
Launches a path in the system's default web browser.
-
std::vector< std::string >stackTrace ()=0
Returns a stack trace (aka backtrace) where
stackTrace()
[0] == caller,stackTrace()
[1] == caller's parent, etc. -
voidsetThreadName (const std::string &name)=0
Sets the name of the current thread to name .
-
const std::vector< DisplayRef > &getDisplays ()=0
Returns a std::vector of Displays connected to the system.
Static Public Member Functions
Protected Member Functions
-
Platform ()
-
voidprepareAssetLoading ()
Called when asset directories are first prepared, subclasses can override to add platform specific directories.
-
voidfindAndAddDefaultAssetPath ()
Called to add the default assets folder by walking up the path from the executable until a folder named 'assets' is found. Subclasses can override this method to disable this functionality.