Skip to content

Set default externalPlayerPath - #1702

Merged
feross merged 2 commits into
webtorrent:masterfrom
314eter:externalplayerpath
Sep 19, 2019
Merged

feross merged 2 commits into
webtorrent:masterfrom
314eter:externalplayerpath

Conversation

@314eter

@314eter 314eter commented Sep 18, 2019

Copy link
Copy Markdown
Contributor

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

welcome Bot commented Sep 18, 2019

Copy link
Copy Markdown

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

@mathiasvr

Copy link
Copy Markdown
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

314eter commented Sep 18, 2019

Copy link
Copy Markdown
Contributor Author

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

@mathiasvr

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread src/renderer/lib/state.js Outdated
return
}
} else if (saved.prefs.externalPlayerPath == null) {
saved.prefs.externalPlayerPath = ''

Copy link
Copy Markdown
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
Copy Markdown
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.

@hicom150 hicom150 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍

@feross feross left a comment

Copy link
Copy Markdown
Member

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

welcome Bot commented Sep 19, 2019

Copy link
Copy Markdown

🎉 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.

4 participants