-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[Electron] Don't stat for electron save dialog #7197
Conversation
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.
Nice catch, it is broken. But your fix is partial:
const uri = FileUri.create(filename);
const exists = await this.fileSystem.exists(uri.toString());
if (!exists) {
resolve(uri);
return;
}
const canAccess = await this.canReadWrite(uri);
resolve(canAccess ? uri : undefined);
And please fix the other bug in the showOpenDialog
. Thoughts? Thanks!
@kittaakos Sure I'll update the PR. I don't think the open dialog is broken, though. I would expect the file to be opened would already need exist? |
It is, it resolves to a promise, but we never |
Signed-off-by: Rob Moran <[email protected]>
b3c1ae6
to
f60c7da
Compare
Updated |
@kittaakos happy with this change? |
I am trying it now... |
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.
Nice! 👍 It was completely broken. Thank you for the fix, @thegecko
Thanks @kittaakos ! |
Signed-off-by: Rob Moran [email protected]
What it does
When using the
fileDialogService.showSaveDialog()
function in Electron, amessageService
message is shown if the file input doesn't yet exist:Cannot access resource at <file>.
This is because there is an explicit stat check for the file to see if it is readable/writable, but it's possible it doesn't yet exist.
This looks like it may be a copy-paste error from the
OpenDialog()
, but I can update this PR if the checks need to be kept for when the file already exists.How to test
Using the electron version, save an existing file as a new file which doesn't exist and observe the message.
Review checklist
Reminder for reviewers