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

Set default externalPlayerPath #1702

Merged
merged 2 commits into from
Sep 19, 2019
Merged

Conversation

314eter
Copy link
Contributor

@314eter 314eter commented Sep 18, 2019

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • New feature
  • Other, please explain:

What changes did you make?

PR #1498 fixed issue #1652 for downloadPath and torrentsFolderPath, but not for externalPlayerPath. I changed the default value to "".

Is there anything you'd like reviewers to focus on?

I handled existing config files that have externalPlayerPath = null by changing this to "" when loading the config file. It's not a beautiful solution, but otherwise they have to edit it by hand.

@welcome
Copy link

welcome bot commented Sep 18, 2019

🙌 Thanks for opening this pull request! You're awesome.

@mathiasvr
Copy link
Contributor

Hi, thanks for looking into this.

I wonder how it can be partially fixed, maybe it does not work for the other paths as well?

I think we should allow externalPlayerPath to still be null, and handle the cases where it is not allowed.
If this is the same error as #1652, I think we should add an appropriate null check in the path-selector component instead.

@314eter
Copy link
Contributor Author

314eter commented Sep 18, 2019

The other paths are not set to null when a new config file is created.

@mathiasvr
Copy link
Contributor

I see, so maybe setting it to undefined fixes it as well?
I still think we should handle it in the path-selector though, I can look into it later, unless you’re up for it? 😉

@mathiasvr
Copy link
Contributor

Okay, I have opened #1704 to handle the null's in the path-selector component.

However, we should still consider changing the default externalPlayerPath to a string type.

@@ -207,6 +207,8 @@ function load (cb) {
onSavedState(err)
return
}
} else if (saved.prefs.externalPlayerPath == null) {
saved.prefs.externalPlayerPath = ''
Copy link
Member

Choose a reason for hiding this comment

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

The correct way to handle old configuration values is by adding an entry to the migrations.js file to "upgrade" the user's config when they update to a new version of the app. This way, we can handle the migration in one place. Then, throughout the rest of the codebase we can just assume that the configuration file has the new format. So, in this case, we could just assume that saved.prefs.externalPlayerPath will always be a string going forward :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the migration, assuming the next version will be 0.21.1.

Copy link
Contributor

@hicom150 hicom150 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Member

@feross feross left a comment

Choose a reason for hiding this comment

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

LGTM

@feross feross merged commit b9bcf74 into webtorrent:master Sep 19, 2019
@welcome
Copy link

welcome bot commented Sep 19, 2019

🎉 Congrats on getting your first pull request landed!

@hicom150 hicom150 added this to the 0.21.1 milestone Sep 25, 2019
@hicom150 hicom150 modified the milestones: 0.21.1, 0.22.0 Dec 12, 2019
@hicom150 hicom150 mentioned this pull request Jan 6, 2020
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

4 participants