-
Notifications
You must be signed in to change notification settings - Fork 163
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
Create app.toml with default values if it doesn't exist #221
Create app.toml with default values if it doesn't exist #221
Conversation
create app.toml with default values if it doesn't already exist Closes: 182
create constructors for other themes for consistency Closes: 182
spotify_player/src/state/mod.rs
Outdated
@@ -10,7 +10,7 @@ pub use model::*; | |||
pub use player::*; | |||
pub use ui::*; | |||
|
|||
use crate::config; | |||
use crate::config::{self}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a weird import. Is it different from use crate::config
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this happened as I imported AppConfig directly at some stage e.g. use crate::config::{self, AppConfig}
.
Reverted anyway 👍
spotify_player/src/config/mod.rs
Outdated
// parses configurations from an application config file in `path` folder, | ||
// then updates the current configurations accordingly. | ||
pub fn parse_config_file(&mut self, path: &Path) -> Result<()> { | ||
fn parse_config_file(&mut self, path: &Path) -> Result<Option<()>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer returning Result<bool>
and the function document should be updated with: "Returns false if no config file found and true otherwise".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this. Look good! Only need a few changes.
better constructor comment Co-authored-by: Thang Pham <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty!
If an application configuration file is not found, one will be created with default values in the config directory.
The configs have been refactored to use
new
constructors instead of default implementations.closes #182