This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
#include <ofFileUtils.h>
Static Public Member Functions | |
static std::string | getFileExt (const of::filesystem::path &filename) |
static std::string | removeExt (const of::filesystem::path &filename) |
static std::string | addLeadingSlash (const of::filesystem::path &path) |
static std::string | addTrailingSlash (const of::filesystem::path &path) |
static std::string | removeTrailingSlash (const of::filesystem::path &path) |
static std::string | getPathForDirectory (const of::filesystem::path &path) |
static std::string | getAbsolutePath (const of::filesystem::path &path, bool bRelativeToData=true) |
static bool | isAbsolute (const of::filesystem::path &path) |
static std::string | getFileName (const of::filesystem::path &filePath, bool bRelativeToData=true) |
static std::string | getBaseName (const of::filesystem::path &filePath) |
static std::string | getEnclosingDirectory (const of::filesystem::path &filePath, bool bRelativeToData=true) |
static bool | createEnclosingDirectory (const of::filesystem::path &filePath, bool bRelativeToData=true, bool bRecursive=true) |
static std::string | getCurrentWorkingDirectory () |
static std::string | join (const of::filesystem::path &path1, const of::filesystem::path &path2) |
static std::string | getCurrentExePath () |
static std::string | getCurrentExeDir () |
static std::string | getUserHomeDir () |
static std::string | makeRelative (const of::filesystem::path &from, const of::filesystem::path &to) |
Detailed Description
Static class for working with file path strings.
Member Function Documentation
◆ addLeadingSlash()
|
static |
Prepend path with a slash, ie. "images" -> "/images".
- Parameters
-
path file or directory path
- Returns
- slah + path
◆ addTrailingSlash()
|
static |
Append path with a slash, ie. "images" -> "images/".
- Parameters
-
path directory path
- Returns
- path + slash
◆ createEnclosingDirectory()
|
static |
Create the enclosing parent directory of a path, ie. "images" is the enclosing directory of "duck.jpg" = "images/duck.jpg".
Assumes the path is in the data folder & automatically creates nested directories as required.
- Parameters
-
bRecursive set to false to override automatically nested directory creation bRelativeToData set to false if you are working with paths that are not in the data folder and want the direct path without relative "../../"
- Returns
- true if the enclosing directory was created
◆ getAbsolutePath()
|
static |
Get the absolute, full path for a given path, ie. "images" -> "/Users/mickey/of/apps/myApps/Donald/bin/data/images".
- Parameters
-
path file or directory path bRelativeToData set to false if you are working with paths that are not in the data folder and want the direct path without relative "../../"
- Returns
- absolute path
◆ getBaseName()
|
static |
Get a file name without its extension, ie. "images/duck.jpg" -> "duck" and "images/some/folder" -> "folder"
- Parameters
-
filePath file path
- Returns
- basename
◆ getCurrentExeDir()
|
static |
Get the full path to the application's parent directory.
Windows & Linux: the application's parent directory Mac: the Contents/MacOS folder within the application's .app bundle
- Returns
- current executable directory
◆ getCurrentExePath()
|
static |
Get the full path to the application's executable file.
Mac: the binary within the application's .app bundle Contents/MacOS dir Windows: the .exe Linux: the binary file itself
- Returns
- current executable path
◆ getCurrentWorkingDirectory()
|
static |
Get the full path to the app's current working directory.
This may be the app's parent directory or the location the app was launched from (aka on the commandline).
- Warning
- This location may change if you or a library calls the cd() std C function.
- Returns
- current working directory
◆ getEnclosingDirectory()
|
static |
Get the enclosing parent directory of a path, ie. "images/duck.jpg" -> "images", assumes the path is in the data directory.
- Parameters
-
filePath file path bRelativeToData set to false if you are working with paths that are not in the data folder and want the direct path without relative "../../"
- Returns
- enclosing directory
◆ getFileExt()
|
static |
Get the extension of a filename, ie. "duck.jpg" -> "jpg".
- Parameters
-
filename file path
- Returns
- filename extension only
◆ getFileName()
|
static |
Get the filename of a given path by stripping the parent directories ie. "images/duck.jpg" -> "duck.jpg", assumes the path is in the data folder.
- Parameters
-
filePath file path bRelativeToData set to false if you are working with paths that are not in the data folder and want the direct path without relative "../../"
- Returns
- filename
◆ getPathForDirectory()
|
static |
Cleaned up a directory path by adding a trailing slash if needed.
For Windows-style path strings using "\", a "" will be added. For Unix-style path strings using "/", a "/" will be added.
- Parameters
-
path directory path
- Returns
- cleaned path + trailing slash (if needed)
◆ getUserHomeDir()
|
static |
Get the absolute path to the user's home directory.
Mac OSX: /Users/<username> Windows: <root>\Users<username> Linux: /home/<username>
- Returns
- home directory path
◆ isAbsolute()
|
static |
Check if a path is an absolute (aka a full path), ie. "images" -> false, "/Users/mickey/of/apps/myApps/Donald/bin/data/images" -> true.
- Parameters
-
path file or directory path
- Returns
- true if the path is an absolute path
◆ join()
|
static |
Create a single path by joining path1 & path2 using a slash, ie. "/hello/world" + "foo/bar" -> "/hello/world/foo/bar".
- Parameters
-
path1 left half of the path to join path2 right half of the path to join
- Returns
- joined path
◆ makeRelative()
|
static |
Make one path relative to another, ie. the relative path of "images/felines/lions" to "images/felines/tigers" is "../tigers".
- Parameters
-
from starting path to destination path
- Returns
- relative path
◆ removeExt()
|
static |
Remove extension from a filename, ie. "duck.jpg" ->"duck".
- Parameters
-
filename file path
- Returns
- filename without extension
◆ removeTrailingSlash()
|
static |
Remove a path's trailing slash (if found), ie. "images/" -> "images".
- Parameters
-
path directory path
- Returns
- path minus trailing slash
The documentation for this class was generated from the following files:
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/utils/ofFileUtils.h
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/utils/ofFileUtils.cpp