Skip to content

Commit 3839802

Browse files
authored
ofAppUtils::ofGetAppName
1 parent 900b98d commit 3839802

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

libs/openFrameworks/utils/ofFileUtils.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,20 @@ class ofFilePath {
446446
static of::filesystem::path getCurrentExeDirFS();
447447
static std::string getCurrentExeDir();
448448

449+
/// Get the App name of the running binary
450+
///
451+
/// \param strip_debug removes a trailing "Debug" if present
452+
/// \returns the App name as native string
453+
static auto getAppName(bool strip_debug = true) {
454+
auto name = ofFilePath::getCurrentExePathFS().filename().native();
455+
if (strip_debug) {
456+
if (name.size() > 5 && name.compare(name.size() - 5, 5, "Debug") == 0) {
457+
name.erase(name.size() - 5);
458+
}
459+
}
460+
return name;
461+
}
462+
449463
/// Get the absolute path to the user's home directory.
450464
///
451465
/// Mac OSX: /Users/<username>

0 commit comments

Comments
 (0)