Implemented different with_native_path conversion methods, refactoring fs functions to utilize with_native_path, and move exists to use with_native_path - #159805
Open
asder8215 wants to merge 1 commit into
Conversation
Collaborator
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
…g fs functions to utilize with_native_path, and move exists to use with_native_path
asder8215
force-pushed
the
with_native_path_exists
branch
from
July 24, 2026 00:32
ef0365c to
7016b77
Compare
Contributor
Author
|
To give a heads up, this PR might be better to wait on #158168 to merge in first, so that I can have |
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.
This PR attempts to complete the FIXME comment on trying to introduce the different conversion functions of
with_native_pathon all supported platforms and also moves theexistsfilesystem functions to utilizewith_native_path. It should be easier to makereaddirandremove_dir_allutilizewith_native_path, which I'm down to support that transition in a separate PR.I took note on what each platform fs functions does underneath the hood to decide the argument it should take:
run_path_with_cstrjust like Unix, so it was clear for their fs functions to take a&CStr&Pathto&str, so I just changed the arguments to&strcstrfunction that converts a&Pathtoio::Result<CString>, so I made its fs functions take in a&CStranywayscrate::path::absolute(returns aResult<PathBuf>) oruefi_fs::File::from_path, which calls oncrate::path::absoluteanyways, so it made sense for me to make its fs functions take aPathBuf.I did some other refactoring such as putting
with_native_pathfunctions withinstd/src/sys/path(except forunsupported.rswhich haswith_native_pathimplemented within its file). I thought it made sense to centralize the differentwith_native_path(aside fromrun_path_with_cstrcan just use the aliaswith_native_path) functions there considering that's done for Windows. I also renamed theunsupported_backslash.rsfile tosolid.rsbecause it seems like solid is the only one that utilizes that file; theunix.rsfile was renamed tocommon.rsbecause that's used by unix platforms, motor, and other miscellaneous platforms (motor platform has a differentwith_native_pathimplementation however).If there's anything here that I should revert or change from platform to platform, just let me know.