Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a button to file open dialog to convert backslashes to forward slashes #6932

Open
jasongrout opened this issue Aug 2, 2019 · 6 comments

Comments

@jasongrout
Copy link
Contributor

As noted in #5051 and #5626, windows users would sometimes like to type in paths that have backslashes in them. For example, a windows user might get such a path from an error message in the kernel, or from some other file browser in the operating system. It can be annoying for a windows user to convert a backslash-delimited path to the forward-slash delimited path JupyterLab (and the Jupyter server) expects.

One idea that came up in #5626 is a button in the file open dialog that simply replaces backslashes with forward slashes in the textbox. That way a user can easily normalize their path right in that dialog. Perhaps the button is only active if we detect a backslash in the path.

@jasongrout jasongrout added this to the Future milestone Aug 2, 2019
@jasongrout jasongrout changed the title Add a "normalize path" button to the file open dialog when it detects backslash paths Add a button to file open dialog to convert backslashes to forward slashes Aug 2, 2019
This was referenced Aug 2, 2019
@vidartf vidartf mentioned this issue Sep 12, 2019
@tgeorgeux
Copy link
Contributor

Jason in #5626 you mentioned:

We could definitely detect backslashes. I wouldn't want to assume that backslashes are path separators, but we could give the user a helpful option.

To my understanding backslashes can be used in file names on Linux and OS, but not in windows, does it make sense to auto-change it if both a Windows operating system and backslashes are detected? It seems we could get rid of the button in that case.

@tgeorgeux tgeorgeux modified the milestones: Future, 2.0 Sep 16, 2019
@jasongrout
Copy link
Contributor Author

backslashes can be used in file names on Linux and OS, but not in windows,

backslashes (\) are a windows-only thing. Forward slashes work on windows too, IIRC. Linux and macOS are forward-slash-only.

does it make sense to auto-change it if both a Windows operating system and backslashes are detected

I don't think we can do that reliably in a way that is intuitive for the user. We have three possibly different computers here:

  • the one running the browser
  • the one running the server
  • the one running the kernel

Are you suggesting that if all of these three computers are windows, and we detect a backslash, we can automatically convert it to a forward slash? I think that's a bit too magical and unpredictable.

@tgeorgeux
Copy link
Contributor

I was operating under the assumption that the Kernel and Server would be on the same machine. I suppose that's not always the case.

@jasongrout
Copy link
Contributor Author

Often the kernel and server are on the same machine these days. That assumption will probably hold less and less moving forward as we have cloud deployments. However, there still is the question of which of the browser or server OS to pay attention to.

@vidartf
Copy link
Member

vidartf commented Sep 17, 2019

Just for clarity: The "open file dialog" will be communicating to a contents manager (are drives supported?), which might be somewhere else than the server (the kernel should not be taken into account, except as a possible source of a path). The paths should follow the spec here: https://jupyter-notebook.readthedocs.io/en/stable/extending/contents.html#apipaths

@jasongrout
Copy link
Contributor Author

the kernel should not be taken into account, except as a possible source of a path

For context, this entire discussion started because someone wanted to easily paste in paths from a kernel error message into the open dialog box. That seems reasonable, and gave rise to backslash paths when the kernel was running on windows.

@jasongrout jasongrout modified the milestones: 2.0, Future Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants