fix: show FDD/HDD disk labels on Windows (backslash paths)#15
Merged
Conversation
dirname() only recognized '/', so Windows paths from the native file dialog (e.g. C:\games\disk.fdi) split to an empty directory and scanFolder failed with ExtractFailed. The drive slot was then cleared, leaving the FDD/HDD menu blank instead of showing the source and disk names. macOS/Linux use '/' and were unaffected. Also reconstruct sibling paths using the input's own separator so they round-trip with the original path and indexOfPath can identify the currently-mounted disk (previously the '/'-joined path never matched a backslash original, so the disk name fell back to "(no disk)"). - dirname: recognize both '/' and '\' via new lastSep helper - scanFolder: join with the input separator, not a hardcoded '/' - add dirname tests for Windows-style paths Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
概要
WindowsでFDD/HDDメニューにマウント中のファイル名・ディスク名が表示されない不具合を修正します(macOS/Linuxは正常)。
原因
ドライブメニューの表示は、スロットに格納された
ImageSet(sourceと各ディスクのname)から描画されます。プレーンなディスクをマウントするとmountPlainInto→archive.scanFolderがスロットを構築しますが、archive.zigのdirnameが/のみを区切り文字として扱っていました。Windowsではネイティブファイルダイアログ(nfd)が
C:\games\disk.fdiのようにバックスラッシュ区切りのパスを返すため、dirnameが空文字を返し →scanFolderがError.ExtractFailed→ スロットがクリアされ、メニューが空欄になっていました。さらに兄弟ファイルのパスを
"{s}/{s}"固定で連結していたため、indexOfPathのバイト完全一致が外れ、現在マウント中ディスクの判定も外れて(no disk)表示になる二次バグもありました。修正内容
dirname:lastSepヘルパーを追加し、/と\の両方を区切り文字として認識scanFolder: パス連結を入力パスの区切り文字に合わせ、元のパスと完全に往復一致させてindexOfPathが現在ディスクを特定できるようにdirnameテストを追加テスト
zig build test全パス(EXIT=0)。🤖 Generated with Claude Code