Skip to content

ofFilePath::getAppName: return std::string, fix SWIG binding gen - #8689

Open
danoli3 wants to merge 1 commit into
openframeworks:masterfrom
danoli3:swig-fix-getappname
Open

danoli3 wants to merge 1 commit into
openframeworks:masterfrom
danoli3:swig-fix-getappname

Conversation

@danoli3

@danoli3 danoli3 commented Nov 26, 2026

Copy link
Copy Markdown
Member

Fixes the SWIG syntax error at libs/openFrameworks/utils/ofFileUtils.h:454 reported in #8684.

ofFilePath::getAppName() was declared static const auto and returned the result of std::filesystem::path::native(). SWIG 4's C++ parser rejects the trailing-type-deduced auto return and bails with a syntax error during binding generation.

Return std::string explicitly and switch the body to path::string() + plain std::string suffixes. This also fixes a latent cross-platform wart: filename().native() is std::wstring on Windows and std::string elsewhere, so the previous auto silently returned a different type per platform.

Minimal diff (one file, six lines). No upstream caller relies on the deduced type, so no API fallout. If the pair pattern used by getCurrentExePath / getCurrentExePathFS is preferred, a companion getAppNameFS() returning of::filesystem::path can be added in a follow-up; per the discussion the recommendation is "whatever passes CI is good enough."

SWIG 4 fails to parse the trailing-return deduced from std::filesystem::path::native(),
exiting with a syntax error at ofFileUtils.h:454 when generating bindings
(openframeworks#8684).

Return std::string explicitly and use path::string() for a consistent cross-platform
return type (filename().native() is std::wstring on Windows, std::string elsewhere,
so the previous auto silently returned a different type per platform).

No upstream callers rely on the deduced type.
@danoli3
danoli3 force-pushed the swig-fix-getappname branch from 03d9346 to 1bb49fc Compare November 27, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant