Fix unicode path handling in codegen#1312
Open
LPuehringerStudent wants to merge 1 commit intogeode-sdk:mainfrom
Open
Fix unicode path handling in codegen#1312LPuehringerStudent wants to merge 1 commit intogeode-sdk:mainfrom
LPuehringerStudent wants to merge 1 commit intogeode-sdk:mainfrom
Conversation
On Windows, std::ifstream and std::ofstream don't handle Unicode paths correctly when constructed from std::filesystem::path because they convert to narrow strings using the system code page. This commit adds cross-platform helper functions openInputFile() and openOutputFile() that: - On Windows: use path.wstring() to properly handle Unicode characters - On other platforms: use the standard path constructor Fixes geode-sdk#126
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #126 - Unicode path handling in codegen.
Problem
On Windows,
std::ifstreamandstd::ofstreamdon't handle Unicode paths correctly when constructed fromstd::filesystem::path. They convert to narrow strings using the system code page, which causes failures when usernames or paths contain non-ASCII characters (e.g., ñ, é, 中).Solution
Added cross-platform helper functions
openInputFile()andopenOutputFile()inShared.hppthat:path.wstring()to properly handle Unicode characters via the wide-character stream constructorsstd::filesystem::pathconstructor (no change needed)Changes
codegen/src/Shared.hpp: Added helper functions and updatedwriteFile()to use themcodegen/src/Main.cpp: Updated version file reading to use the new helperTesting
This fix allows codegen to work correctly when the bindings repository or SDK is located in paths containing Unicode characters, such as usernames with special characters.