Skip to content

Forward slash / is not transparently translated on Windows, does not work with path completion #2535

Closed

Description

@evelant

Describe the bug
Forward slash / is not transparently converted to \ on windows. On windows powershell you can use a / and it's automatically translated to a backslash \. It would be nice if Nushell emulated this behavior as it makes working across windows and unix machines much more ergonomic.

To Reproduce
There seem to be a few corner case behaviors here

  1. cd my/directory ends up with path C:\path\to\my/directory. cd succeeds but / gets preserved in path. Powershell will cd and transform the forward slash to a backslash.
  2. cd my/dir<tab><tab> autocomplete will not complete if there's a forward slash on windows. Powershell completes this and converts it to a backslash.
  3. ./myProgram will not run myProgram. This works on powershell.
  4. Probably other ones I haven't noticed yet

Expected behavior
Forward slashes are transparently converted to back slashes on windows (or possibly otherwise follow powershell's behavior if there are corner cases?)

Configuration (please complete the following information):

  • OS (e.g. Windows): Windows 10
  • Nu version (you can use the version command to find out): 0.19.0
  • Optional features (if any): default clipboard trash

Activity

  1. thegedge commented on Sep 11, 2020

    @thegedge
    Contributor

    I'm currently working on a path abstraction for nushell that should hopefully take care of all of these issues (and some others).

    The only difference is that I don't intend to change forward slashes to backslashes in (2). My thought here is that if the user is using forward slashes, they'd prefer to continue seeing forward slashes.

    Decided to not explore an abstraction any further, as it appeared to result in a lot of duplication of things in Path / PathBuf. Going to find other ways to improve things here.

  2. self-assigned this
    on Sep 11, 2020
  3. added
    category:enhancement
    deprecated:platform-specific
    polish
    on Sep 11, 2020
  4. radekvit commented on Sep 16, 2020

    @radekvit
    Contributor

    Personally, I would prefer if it was the other way around, so that backslashes \ were translated to / in displayed paths in Nu:
    C:/path/to/my/directory
    This would make nu more consistent across platforms.

    (cd Dir1\Dir2 would still work, of course)

  5. github-actions commented on Jun 24, 2021

    @github-actions

    This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

  6. sophiajt commented on Jul 7, 2021

    @sophiajt
    Contributor

    More recent path-completion seems to work better to switch the path separator automatically. Closing, but please reopen if you're still seeing an issue.

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

Metadata

Metadata

Assignees

Labels

category:enhancementdeprecated:platform-specificpolish

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions