You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Forward slash / is not transparently translated on Windows, does not work with path completion #2535
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
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.
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.
./myProgram will not run myProgram. This works on powershell.
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
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.
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)
Reacted by Jason Gedge, Sympatron GmbH, avrong, Jeremy and kkkiio
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.
Activity
thegedge commentedon Sep 11, 2020
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.radekvit commentedon Sep 16, 2020
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/directoryThis would make nu more consistent across platforms.
(
cd Dir1\Dir2would still work, of course)github-actions commentedon Jun 24, 2021
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.
sophiajt commentedon Jul 7, 2021
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.