This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
Go to the source code of this file.
Classes | |
class | ofBuffer |
struct | ofBuffer::Line |
struct | ofBuffer::RLine |
struct | ofBuffer::Lines |
struct | ofBuffer::RLines |
class | ofFilePath |
class | ofFile |
class | ofDirectory |
Functions | |
ofBuffer | ofBufferFromFile (const of::filesystem::path &path, bool binary=true) |
bool | ofBufferToFile (const of::filesystem::path &path, const ofBuffer &buffer, bool binary=true) |
void | ofEnableDataPath () |
Enable the use of the data path. | |
void | ofDisableDataPath () |
Disable the use of the data path. | |
std::string | ofToDataPath (const of::filesystem::path &path, bool absolute=false) |
Make a path relative to the location of the data/ folder. | |
bool | ofRestoreWorkingDirectoryToDefault () |
Reset the working directory to the platform default. | |
void | ofSetDataPathRoot (const of::filesystem::path &root) |
Set the relative path to the data/ folder from the executable. | |
Function Documentation
◆ ofBufferFromFile()
ofBuffer ofBufferFromFile | ( | const of::filesystem::path & | path, |
bool | binary = true |
||
) |
Read the contents of a file at path into a buffer.
Opens as a text file by default.
- Parameters
-
path file to open binary set to false if you are reading a text file & want lines split at endline characters automatically
◆ ofBufferToFile()
bool ofBufferToFile | ( | const of::filesystem::path & | path, |
const ofBuffer & | buffer, | ||
bool | binary = true |
||
) |
Write the contents of a buffer to a file at path.
Saves as a text file by default.
- Parameters
-
path file to open buffer data source to write from binary set to false if you are writing a text file & want lines split at endline characters automatically
◆ ofDisableDataPath()
void ofDisableDataPath | ( | ) |
Disable the use of the data path.
This function causes ofToDataPath() to ignore the relative path set with ofSetDataPathRoot().
◆ ofEnableDataPath()
void ofEnableDataPath | ( | ) |
Enable the use of the data path.
Path
This function causes ofToDataPath() to respect the relative path set with ofSetDataPathRoot(). This is enabled by default.
◆ ofRestoreWorkingDirectoryToDefault()
bool ofRestoreWorkingDirectoryToDefault | ( | ) |
Reset the working directory to the platform default.
The default working directory is where the application was started from or the exe directory in case of osx bundles. GLUT might change the default working directory to the resources directory in the bundle in osx. This will restore it to the exe dir or whatever was the current dir when the application was started
◆ ofSetDataPathRoot()
void ofSetDataPathRoot | ( | const of::filesystem::path & | root | ) |
Set the relative path to the data/ folder from the executable.
This method can be useful when users want to embed the data as a resource folder within an *.app bundle on OSX or perhaps work from a shared data folder in the user's Documents directory.
- Warning
- The provided path must have a trailing slash (/).
- Parameters
-
root The path to the data/ folder relative to the app executable.
◆ ofToDataPath()
std::string ofToDataPath | ( | const of::filesystem::path & | path, |
bool | absolute = false |
||
) |
Make a path relative to the location of the data/ folder.
This funtion returns path unchanged if ofDisableDataPath() was called first.
By default, a relative path is returned. Users requiring absolute paths for (e.g. for non-openFrameworks functions), can specify that an absolute path be returned.
- Parameters
-
path The path to make relative to the data/ folder. absolute Set to true to return an absolute path.
- Returns
- the new path, unless paths were disabled with ofDisableDataPath().