Skip to content

fix: show FDD/HDD disk labels on Windows (backslash paths)#15

Merged
bubio merged 1 commit into
mainfrom
fix/windows-disk-menu-labels
Jun 11, 2026
Merged

fix: show FDD/HDD disk labels on Windows (backslash paths)#15
bubio merged 1 commit into
mainfrom
fix/windows-disk-menu-labels

Conversation

@bubio

@bubio bubio commented Jun 11, 2026

Copy link
Copy Markdown
Owner

概要

WindowsでFDD/HDDメニューにマウント中のファイル名・ディスク名が表示されない不具合を修正します(macOS/Linuxは正常)。

原因

ドライブメニューの表示は、スロットに格納された ImageSetsource と各ディスクの name)から描画されます。プレーンなディスクをマウントすると mountPlainIntoarchive.scanFolder がスロットを構築しますが、archive.zigdirname/ のみを区切り文字として扱っていました。

Windowsではネイティブファイルダイアログ(nfd)が C:\games\disk.fdi のようにバックスラッシュ区切りのパスを返すため、dirname が空文字を返し → scanFolderError.ExtractFailed → スロットがクリアされ、メニューが空欄になっていました。

さらに兄弟ファイルのパスを "{s}/{s}" 固定で連結していたため、indexOfPath のバイト完全一致が外れ、現在マウント中ディスクの判定も外れて (no disk) 表示になる二次バグもありました。

修正内容

  • dirname: lastSep ヘルパーを追加し、/\ の両方を区切り文字として認識
  • scanFolder: パス連結を入力パスの区切り文字に合わせ、元のパスと完全に往復一致させて indexOfPath が現在ディスクを特定できるように
  • Windows形式パス用の dirname テストを追加

テスト

zig build test 全パス(EXIT=0)。

🤖 Generated with Claude Code

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>
@bubio bubio merged commit 344e9f4 into main Jun 11, 2026
3 checks passed
@bubio bubio deleted the fix/windows-disk-menu-labels branch June 11, 2026 06:38
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