Repository navigation
Conversation
If no config file is found, use the config.toml from the repository, which is embedded at build time, instead of panicking. A config file in any of the existing locations still takes precedence. This mostly helps Flatpak users, where the config file ends up in a different directory than expected and Spotify crashes on startup.
Author
|
One small follow-up, depending on which of this and #212 gets merged first: since The fix is just adding $(BINARY_SOURCE): $(wildcard src/*.rs) Cargo.toml config.tomlI left it out of both PRs so they don't conflict with each other. Happy to add it to whichever one ends up merged second. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now, if no config file is found, the library panics with
Failed to find config.and Spotify crashes on startup. This comes up every now and then, mostly with Flatpak, where the config has to go into~/.var/app/com.spotify.Client/config/instead of~/.config/(see #185).With this change,
config.tomlfrom the repository is embedded at build time withinclude_str!and used when no config file exists. A config file in/etc/spotify-adblock/or$XDG_CONFIG_HOME/spotify-adblock/still takes precedence. A config file that exists but can't be read or parsed still panics as before, so mistakes in a custom config don't go unnoticed.I also updated the Configuration section in the README. It still mentioned the allowlist, which was removed in 45747b6.
Tested by hiding
/etc/spotify-adblockwith no user config present. The log showsNo config found, using default config., ad URLs are blocked, and everything else goes through. With a user config present, that config is used.