-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Copy absolute path with first slash in the file browser #15168
Copy absolute path with first slash in the file browser #15168
Conversation
Thanks for making a pull request to jupyterlab! |
@@ -65,6 +65,7 @@ import { | |||
import { find, map } from '@lumino/algorithm'; | |||
import { CommandRegistry } from '@lumino/commands'; | |||
import { ContextMenu } from '@lumino/widgets'; | |||
import { posix } from 'path'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work as the code is running in the browser, not in a Node runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function PathExt.join
was wrapped by it, and it can be execed in browser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it cannot be used in browser because browsers do not implement Node runtime. You would need to add a dependency on path-browserify
, which is what the @jupyterlab/coreutils
package which implements PathExt.join
does:
"path-browserify": "^1.0.0", |
However, ideally this implementation detail and dependency would not be propagated to filebrowser-extension, and either a new argument would be added to one of PathExt
methods, or a new method created altogether and used in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @pauky
References
Follow-up of #14842
There is no first slash when coping a absolute path.
Code changes
Change
PathExt.json
toposix.json
.User-facing changes
None.
Backwards-incompatible changes
None.
Edit to specify how it relates to 14842