Fix contribute watchOngoingGameInFile for non-ASCII paths on Windows - #1253
Closed
Hoigin wants to merge 1 commit into
Closed
Fix contribute watchOngoingGameInFile for non-ASCII paths on Windows#1253Hoigin wants to merge 1 commit into
Hoigin wants to merge 1 commit into
Conversation
Owner
|
Thanks for reporting! Fixed in a slightly different way, in 9bb7efc |
Author
|
Verified the alternative fix, closing this in favor of it. Thanks for the great project! |
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.
Summary
On Windows, if the path in
watchOngoingGameFileNamecontains non-ASCII characters, likeD:\Go\跑谱\watchgame.txt, KataGo fails to open the watch file, and the whole contribute process terminates a few seconds after startup with:The root cause is that the Windows branch opens the file with the narrow-char
fopen_s, which interprets the UTF-8 path bytes in the ANSI codepage, so the path no longer matches the real directory (a TODO in contribute.cpp already notes that non-ascii paths are unhandled).This PR converts the path to wide chars and opens it with
_wfopen, the same pattern already used inhomedata.cppandmainargs.cpp.Testing
Verified on Windows 11 (Chinese locale, GBK codepage), KataGo v1.18.2 + this change, MSVC build with
-DBUILD_DISTRIBUTED=1:D:\Go\跑谱\watchgame.txt) now creates the file at the correct path. ASCII-only paths behave as before.