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

use default path in windows when choosing a file #7625

Conversation

ByronEricPerez
Copy link
Contributor

Fixes

Issue Number: #1811

What is the current behavior?

Currently the "Choose File" button opens the root folder of the program and not "My documents" or "My computer" which generates confusion in new users, this error only happens in windows.

What is the new behavior?

Clicking on the "Choose File" button opens the user's root folder.

Other information

PR Checklist

Toggle...

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting)
  • Refactoring (no functional changes)
  • Documentation changes
  • Other - Please describe:

Please check all that apply to this PR using "x":

  • I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
  • I added a line describing my change to CHANGELOG.md
  • I have checked that this PR does not introduce a breaking change
  • This PR introduces breaking changes and I have provided a detailed explanation below

Copy link
Member

@jessopb jessopb left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@@ -47,7 +47,24 @@ class FileSelector extends React.PureComponent<Props> {
};

handleDirectoryInputSelection = () => {
remote.dialog.showOpenDialog({ properties: ['openDirectory'] }).then((result) => {
var defaultPath;
Copy link
Member

Choose a reason for hiding this comment

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

Just a minor nitpick, but it's usually better to use let when you can.

properties = ['openDirectory'];
}

remote.dialog.showOpenDialog({ properties, defaultPath }).then((result) => {
Copy link
Member

Choose a reason for hiding this comment

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

nice,
tested in console in linux
x = require('@electron/remote')
x.dialog.showOpenDialog({properties: ['openFile'], defaultPath: undefined})
And it worked fine.

@jessopb jessopb merged commit c7ab47f into lbryio:master Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants