-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(path): convert to native encoding on Windows #806
Merged
Merged
Conversation
This file contains 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
lotem
force-pushed
the
path-fix
branch
2 times, most recently
from
February 3, 2024 13:30
78bf12f
to
39ee053
Compare
PTAL @fxliang |
lotem
force-pushed
the
path-fix
branch
2 times, most recently
from
February 3, 2024 13:57
9c7d59e
to
6a5d8dc
Compare
need MORE work. |
Follow @fxliang 's PR, use `u8path` on Windows to convert UTF-8 string to Windows native path. Closes rime#804 Fixes rime/weasel#576 Fixes rime/weasel#1080 BREAKING CHANGE: `installation.yaml` should be UTF-8 encoded. Previouly on Windows, the file can be written in local encoding to enable paths with non-ASCII characters. It should be updated to UTF-8 after this change.
lotem
force-pushed
the
path-fix
branch
3 times, most recently
from
February 5, 2024 11:41
f588ef6
to
88de798
Compare
fix dict_compiler relocate_target: get u8string id from filename
simplify code that used to explicitly constrcut path object
it's broken after the change
fxliang
added a commit
to fxliang/weasel
that referenced
this pull request
Feb 6, 2024
- build librime in ci
fxliang
added a commit
to fxliang/weasel
that referenced
this pull request
Feb 6, 2024
build librime in ci
fxliang
added a commit
to fxliang/weasel
that referenced
this pull request
Feb 6, 2024
build librime in ci
lotem
added a commit
to rime/weasel
that referenced
this pull request
Feb 8, 2024
lotem
added a commit
to rime/weasel
that referenced
this pull request
Feb 8, 2024
lotem
added a commit
to rime/weasel
that referenced
this pull request
Feb 8, 2024
lotem
added a commit
to rime/weasel
that referenced
this pull request
Feb 8, 2024
lotem
added a commit
to rime/weasel
that referenced
this pull request
Feb 8, 2024
lotem
added a commit
to rime/weasel
that referenced
this pull request
Feb 8, 2024
lotem
added a commit
to rime/weasel
that referenced
this pull request
Feb 8, 2024
lotem
added a commit
to rime/weasel
that referenced
this pull request
Feb 8, 2024
lotem
added a commit
to rime/weasel
that referenced
this pull request
Feb 8, 2024
lotem
added a commit
to rime/weasel
that referenced
this pull request
Feb 8, 2024
graphemecluster
pushed a commit
to TypeDuck-HK/librime
that referenced
this pull request
Mar 18, 2024
refactor: convert path to native encoding on Windows feat(rime_api): provide secure version of path getter functions `RimeApi::get_*_dir_s`. Follow @fxliang 's PR, use `u8path` on Windows to convert UTF-8 string to Windows native path. Closes rime#804 Fixes rime/weasel#576 Fixes rime/weasel#1080 BREAKING CHANGE: Most `string` filenames in APIs are changed to `path`; `installation.yaml` should be UTF-8 encoded. Previouly on Windows, the file can be written in local encoding to enable paths with non-ASCII characters. It should be updated to UTF-8 after this change. Details of the code refactor Wrap `std::filesystem::path` in a thin wrapper class `rime::path` which calls `std::filesystem::u8path` in the constructor on Windows. Operator `/=` and `/` are also overloaded to convert the right operand from UTF-8 string to native path. Follow these rules to apply correct conversion between `string` and `rime::path`: - construct `rime::path` with UTF-8 encoded string; - get native string by `path::u8string`; - to extract UTF-8 string from `path`, for example to find schema ID from file name, call `path::u8string`; - avoid implicit conversion from string, which results in `std::filesystem::path` without performing UTF-8 to native conversion; - explicitly construct `rime::path` from `std::filesystem::path` before append operation, to ensure the overloaded operator with string conversion is used.
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.
Follow @fxliang 's PR, use
u8path
on Windows to convert UTF-8 string to Windows native path.Closes #804
Fixes rime/weasel#576
Fixes rime/weasel#1080
BREAKING CHANGE:
installation.yaml
should be UTF-8 encoded.Previouly on Windows, the file can be written in local encoding to enable paths with non-ASCII characters. It should be updated to UTF-8 after this change.
Pull request
Issue tracker
Fixes will automatically close the related issue
Fixes #
Feature
Describe feature of pull request
Unit test
Manual test
Code Review
Additional Info