Loading...
Searching...
No Matches
Ogre::FileSystemLayer Class Reference

Provides methods to find out where the Ogre config files are stored and where logs and settings files should be written to. More...

`#include <OgreFileSystemLayer.h>`

Inheritance diagram for Ogre::FileSystemLayer:
[legend]

## Public Member Functions

| FileSystemLayer (const Ogre::String &subdir)
| Creates a concrete platform-dependent implementation of FileSystemLayer.
Ogre::String | getConfigFilePath (Ogre::String filename) const
| Search for the given config file in a set of predefined locations.
Ogre::String | getWritablePath (const Ogre::String &filename) const
| Find a path where the given filename can be written to.
void | setConfigPaths (const Ogre::StringVector &paths)
void | setHomePath (const Ogre::String &path)

## Static Public Member Functions

static bool | createDirectory (const Ogre::String &name)
| Create a directory.
static bool | fileExists (const Ogre::String &path)
| Test if the given file exists.
static bool | removeDirectory (const Ogre::String &name)
| Delete a directory.
static bool | removeFile (const Ogre::String &path)
| Delete a file.
static bool | renameFile (const Ogre::String &oldpath, const Ogre::String &newpath)
| Rename a file.
static String | resolveBundlePath (String path)
| Resolve path inside the application bundle on some platforms Ogre is delivered as an application bundle this function resolves the given path such that it points inside that bundle.

## Detailed Description

Provides methods to find out where the Ogre config files are stored and where logs and settings files should be written to.

In modern multi-user OS, a standard user account will often not have write access to the path where the application is stored. In order to still be able to store graphics settings and log output and for the user to overwrite the default Ogre config files, this class tries to create a folder inside the user's home directory.

## Constructor & Destructor Documentation

## FileSystemLayer()

Ogre::FileSystemLayer::FileSystemLayer | ( | const Ogre::String & | subdir | ) |

inline

Creates a concrete platform-dependent implementation of FileSystemLayer.

Parameters

  subdir | A subdirectory inside the user's path to distinguish between different Ogre applications.

## Member Function Documentation

## getConfigFilePath()

Ogre::String Ogre::FileSystemLayer::getConfigFilePath | ( | Ogre::String | filename | ) | const

inline

Search for the given config file in a set of predefined locations.

The search order is

1. Subdirectory in user Home (see getWritablePath)
2. OS dependent config-paths
3. Current working directory

Parameters

  filename | The config file name (without path)

Returns
  The full path to the config file

References fileExists(), and getWritablePath().

## getWritablePath()

Ogre::String Ogre::FileSystemLayer::getWritablePath | ( | const Ogre::String & | filename | ) | const

inline

Find a path where the given filename can be written to.

This path will usually be a subdirectory in the user's home directory. This function should be used for any output like logs and graphics settings.

Platform | Location
--- | ---
Windows | Documents/$subdir/
Linux | ~/.cache/$subdir/
OSX | ~/Library/Application Support/$subdir/
iOS | NSDocumentDirectory
Android / Emscripten | n/a

Parameters

  filename | Name of the file.

Returns
  The full path to a writable location for the given filename.

Referenced by getConfigFilePath().

## setConfigPaths()

void Ogre::FileSystemLayer::setConfigPaths | ( | const Ogre::StringVector & | paths | ) |

inline

## setHomePath()

void Ogre::FileSystemLayer::setHomePath | ( | const Ogre::String & | path | ) |

inline

## resolveBundlePath()

String Ogre::FileSystemLayer::resolveBundlePath | ( | String | path | ) |

static

Resolve path inside the application bundle on some platforms Ogre is delivered as an application bundle this function resolves the given path such that it points inside that bundle.

Parameters

  path |

Returns
  path inside the bundle

## createDirectory()

bool Ogre::FileSystemLayer::createDirectory | ( | const Ogre::String & | name | ) |

static

Create a directory.

## removeDirectory()

bool Ogre::FileSystemLayer::removeDirectory | ( | const Ogre::String & | name | ) |

static

Delete a directory.

Should be empty

## fileExists()

bool Ogre::FileSystemLayer::fileExists | ( | const Ogre::String & | path | ) |

static

Test if the given file exists.

Referenced by getConfigFilePath().

## removeFile()

bool Ogre::FileSystemLayer::removeFile | ( | const Ogre::String & | path | ) |

static

Delete a file.

## renameFile()

bool Ogre::FileSystemLayer::renameFile | ( | const Ogre::String & | oldpath,
|  | const Ogre::String & | newpath )

static

Rename a file.

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

- OgreFileSystemLayer.h