Skip to content

fix(windows): use wide-char API for non-ASCII path support#386

Open
jjserenity wants to merge 1 commit into
DeusData:mainfrom
jjserenity:fix/windows-wide-path-support
Open

fix(windows): use wide-char API for non-ASCII path support#386
jjserenity wants to merge 1 commit into
DeusData:mainfrom
jjserenity:fix/windows-wide-path-support

Conversation

@jjserenity
Copy link
Copy Markdown

Fixes #357

Replace ANSI Windows APIs with their wide-char (W) counterparts to support non-ASCII UTF-8 paths (CJK, Cyrillic, Turkish, etc.) on Windows.

Changes

  • New src/foundation/win_utf8.h: UTF-8 ↔ UTF-16 conversion helpers (cbm_utf8_to_wide, cbm_wide_to_utf8)
  • src/foundation/compat_fs.c:
    • cbm_opendir/cbm_readdir: FindFirstFileA/FindNextFileAFindFirstFileW/FindNextFileW
    • cbm_mkdir_p: _mkdir_wmkdir
    • cbm_unlink: _unlink_wunlink
    • cbm_rmdir: _rmdir_wrmdir
  • src/foundation/platform.c:
    • cbm_mmap_read: CreateFileA/CreateFileMappingACreateFileW/CreateFileMappingW
    • cbm_file_exists/cbm_is_dir: GetFileAttributesAGetFileAttributesW
    • cbm_file_size: GetFileAttributesExAGetFileAttributesExW
  • src/discover/discover.c:
    • safe_stat + try_load_nested_gitignore + cbm_discover: stat()_wstat64() via new wide_stat() helper

Scope

Windows only — all changes are guarded by #ifdef _WIN32. POSIX paths untouched. Zero behavioral change for macOS/Linux.

Tested

  • All changed files compile clean on MinGW GCC 14.2 (-Wall -Wextra -Werror -fsyntax-only)
  • Full test suite requires POSIX build environment (CI will verify)

Replace ANSI Windows APIs (FindFirstFileA, CreateFileA, etc.) with
wide-char (W) counterparts. Add UTF-8/UTF-16 conversion helpers.
Fix stat() calls in discover pipeline to use _wstat64.

Fixes DeusData#357
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.

Windows non-ASCII path support issue in indexing pipeline

1 participant