Skip to content

refactor: use std::filesystem to refactor file_helper to support utf8 path on Windows #359

Merged
JalinWang merged 22 commits intoalibaba:mainfrom
JalinWang:refactor/file_helper_by_fs_support_utf8
May 8, 2026
Merged

refactor: use std::filesystem to refactor file_helper to support utf8 path on Windows #359
JalinWang merged 22 commits intoalibaba:mainfrom
JalinWang:refactor/file_helper_by_fs_support_utf8

Conversation

@JalinWang
Copy link
Copy Markdown
Collaborator

@JalinWang JalinWang commented Apr 20, 2026

Summary

This PR refactors file/path handling to consistently support UTF-8 paths, with a focus on Windows compatibility.

fix: #339

What Changed

  • rewrote ailego::FileHelper around std::filesystem
  • added UTF-8 path conversion helpers for Windows (UTF-8 <-> wide string)
  • switched Windows file open/create paths from narrow Win32 APIs to wide-char APIs
  • introduced PathJoin, OpenIfstream, and OpenOfstream helpers for UTF-8-safe path and stream handling
  • updated DB path builders and call sites to stop manually concatenating "/" into paths
  • updated version manager recovery and file IO to preserve UTF-8 filenames
  • enabled RocksDB Windows UTF-8 filename support in CMake
  • tightened a small default init in Version and adjusted a few tests/assertions around path behavior

Tests

Added coverage for:

  • UTF-8 directory creation/removal
  • nested UTF-8 paths
  • file create/read/write with UTF-8 names
  • rename across UTF-8 paths
  • UTF-8-safe ifstream / ofstream
  • collection create/open/flush/destroy under UTF-8 paths
  • version manager path handling updates

Comment thread thirdparty/rocksdb/CMakeLists.txt
@alibaba alibaba deleted a comment from chatgpt-codex-connector Bot Apr 29, 2026
@JalinWang
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/db/common/file_helper.cc Outdated
@feihongxu0824 feihongxu0824 requested review from feihongxu0824 and removed request for chinaux and iaojnh May 8, 2026 08:17
Copy link
Copy Markdown
Collaborator

@feihongxu0824 feihongxu0824 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JalinWang JalinWang merged commit 1d4ae0b into alibaba:main May 8, 2026
13 checks passed
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.

[Bug]: support space/Chinese in collection path

3 participants