Skip to content

path.rs: "consts::path_sep" wrong on Windows? #2752

Closed

Description

@kud1ing

I read this

#[cfg(windows)]
mod consts {
    const path_sep: char = '/';  // "The primary path separator character for the platform"
    const alt_path_sep: char = '\\';
}

and

#[doc = "Get the default path separator for the host platform"]
fn path_sep() -> str { ret str::from_char(consts::path_sep); }

as "'/' is the default and primary path separator on Windows".

Is this a bug?

Activity

  1. brson commented on Jun 29, 2012

    @brson
    Contributor

    It's definitely intentional, I think mostly to make it easier on us, since / works in both places. Clearly though it is wrong is some sense. I'm ok with changing it.

  2. kud1ing commented on Jun 29, 2012

    @kud1ing
    Author

    Maybe some additional comments will suffice.

  3. graydon commented on Aug 29, 2012

    @graydon
    Contributor

    Fixed in the new path module (paths get joined with backslash on windows in all cases; though we'll split with forward-slash).

  4. added a commit that references this issue on Jan 9, 2023
  5. added a commit that references this issue on Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions