Skip to content

Conversation

@WrldEngine
Copy link

@WrldEngine WrldEngine commented Oct 23, 2025

Fix the read_dir function in windows for using with native_path

r? @ChrisDenton

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 23, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 23, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot

This comment was marked as outdated.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 23, 2025
@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 23, 2025
@hkBst
Copy link
Member

hkBst commented Oct 24, 2025

@rustbot label +O-windows

@rustbot rustbot added the O-windows Operating system: Windows label Oct 24, 2025
@hkBst
Copy link
Member

hkBst commented Oct 24, 2025

cc @ChrisDenton

@rustbot
Copy link
Collaborator

rustbot commented Oct 26, 2025

ChrisDenton is not on the review rotation at the moment.
They may take a while to respond.

Copy link
Member

@ChrisDenton ChrisDenton left a comment

Choose a reason for hiding this comment

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

This does not seem to fix the issue. It just converts the path to wide and then back again, which is a quite expensive no-op.

View changes since this review

@WrldEngine
Copy link
Author

This does not seem to fix the issue. It just converts the path to wide and then back again, which is a quite expensive no-op.

View changes since this review

But it is beginning of fixing the purpose using this function on all platforms. I covered it on windows, expensive no-op it is the function 'use_with_native_path' at all

@ChrisDenton
Copy link
Member

The purpose of the fixme is to clearly show that there's an issue to be fixed. This PR doesn't fix the issue, it merely hides the issue one level deeper and removes the fixme note.

The performance impact of this is why it's a fixme instead of being implemented that way to start with.

@WrldEngine
Copy link
Author

WrldEngine commented Oct 28, 2025

The purpose of the fixme is to clearly show that there's an issue to be fixed. This PR doesn't fix the issue, it merely hides the issue one level deeper and removes the fixme note.

The performance impact of this is why it's a fixme instead of being implemented that way to start with.

I didnt remove fixme comment
Functionality use_with_native_path is useless itself, and making that no need level, what you said
Better without fixme comments than with itself

Also i see some moments like:

pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
    // FIXME: use with_native_path on all platforms
    #[cfg(not(windows))]
    return imp::copy(from, to);
    #[cfg(windows)]
    with_native_path(from, &|from| with_native_path(to, &|to| imp::copy(from, to)))
}

is it also expensive no-op?
I could fully rewrite readdir function for processing with WCStr, to avoid performance issues, if you agree

@ChrisDenton
Copy link
Member

Yes, if readdir can be rewritten so that it doesn't convert pack to a Path then that would address my concerns.

@WrldEngine
Copy link
Author

@ChrisDenton Can you check now? I removed Path, but couldnt avoid from PathBuf because of DirEntry display info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants