File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
libs/openFrameworks/utils Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -447,6 +447,26 @@ class ofFilePath {
447447 static of::filesystem::path getCurrentExeDirFS ();
448448 static std::string getCurrentExeDir ();
449449
450+ // / Get the App name of the running binary
451+ // /
452+ // / \param strip_debug removes a trailing "Debug" if present
453+ // / \returns the App name as native string
454+ static const auto getAppName (bool strip_debug = true ) {
455+ auto name = ofFilePath::getCurrentExePathFS ().filename ().native ();
456+ #if defined(TARGET_OSX)
457+ auto debug_suffix = std::filesystem::path (" Debug" ).native ();
458+ #else
459+ auto debug_suffix = std::filesystem::path (" _debug" ).native ();
460+ #endif
461+ auto dbsize = debug_suffix.size ();
462+ if (strip_debug) {
463+ if (name.size () > dbsize && name.compare (name.size () -dbsize , dbsize, debug_suffix) == 0 ) {
464+ name.erase (name.size () - dbsize);
465+ }
466+ }
467+ return name;
468+ }
469+
450470 // / Get the absolute path to the user's home directory.
451471 // /
452472 // / Mac OSX: /Users/<username>
You can’t perform that action at this time.
0 commit comments