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

electron: fix 'save as...' cwd #9135

Merged
merged 1 commit into from
Mar 2, 2021
Merged

Conversation

vince-fugnitto
Copy link
Member

What it does

Fixes #9133

The following commit fixes the defaultPath when performing a save as... in electron. Previously, the defaultPath was incorrect leading the dialog to always open where the application started. With these changes, the dialog will open at the current location where the save as... is performed.

How to test

  1. start the example-electron application
  2. open a file (different sublevels to test fully)
  3. perform save as...
  4. confirm that the dialog is opened at the correct path, and the filename is correctly populated in the input

Review checklist

Reminder for reviewers

Signed-off-by: vince-fugnitto vincent.fugnitto@ericsson.com

@vince-fugnitto vince-fugnitto added the electron issues related to the electron target label Feb 26, 2021
@vince-fugnitto vince-fugnitto self-assigned this Feb 26, 2021
@vince-fugnitto vince-fugnitto force-pushed the vf/electron-save-as branch 3 times, most recently from 41118c0 to f4282bf Compare February 26, 2021 21:01
The following commit fixes the `defaultPath` when performing a `save
as...` in `electron`. Previously, the `defaultPath` was incorrect
leading the dialog to always open where the application started. With
these changes, the dialog will open at the current location where the
`save as...` is performed.

Signed-off-by: vince-fugnitto <vincent.fugnitto@ericsson.com>
@kittaakos
Copy link
Contributor

Previously, the defaultPath was incorrect leading the dialog to always open where the application started.

Are you sure about this? Without your changes, it seems to me that it is a "random" folder; in fact, I see the last valid folder always whenever I open the native Save as... (on macOS)

With these changes, the dialog will open at the current location where the save as... is performed.

I can confirm this. It works as expected 👍 Thank you!

The PR title is electron: fix 'save as...' cwd. Why the change in browser? Thanks!

@vince-fugnitto
Copy link
Member Author

Previously, the defaultPath was incorrect leading the dialog to always open where the application started.

Are you sure about this? Without your changes, it seems to me that it is a "random" folder; in fact, I see the last valid folder always whenever I open the native Save as... (on macOS)

At least for me on Linux whenever I performed a save as... it would open the dialog at ~/workspaces/theia/example/electron no matter the workspace - (as in the video of #9133).

With these changes, the dialog will open at the current location where the save as... is performed.

I can confirm this. It works as expected Thank you!

The PR title is electron: fix 'save as...' cwd. Why the change in browser? Thanks!

I can remove the browser change, the change was simply to remove the unnecessary if statement since folder is always defined:

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have verified the changeset with the electron app; it worked as expected.

Thank you for the fix, @vince-fugnitto!

@kittaakos
Copy link
Contributor

I can remove the browser change, the change was simply to remove the unnecessary if statement since folder is always defined:

No need to remove it. Thanks!

@vince-fugnitto vince-fugnitto merged commit cb561d3 into master Mar 2, 2021
@vince-fugnitto vince-fugnitto deleted the vf/electron-save-as branch March 2, 2021 14:14
@github-actions github-actions bot added this to the 1.12.0 milestone Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electron issues related to the electron target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

electron: 'save as...' command opens native dialog at incorrect location
2 participants