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

Create app.toml with default values if it doesn't exist #221

Merged
merged 6 commits into from
Jul 18, 2023

Conversation

cobbinma
Copy link
Contributor

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

create app.toml with default values if it doesn't already exist

Closes: 182
create constructors for other themes for consistency

Closes: 182
@@ -10,7 +10,7 @@ pub use model::*;
pub use player::*;
pub use ui::*;

use crate::config;
use crate::config::{self};
Copy link
Owner

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?

Copy link
Contributor Author

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 👍

// 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<()>> {
Copy link
Owner

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

Copy link
Owner

@aome510 aome510 left a 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.

@cobbinma cobbinma requested a review from aome510 July 18, 2023 09:23
Copy link
Owner

@aome510 aome510 left a comment

Choose a reason for hiding this comment

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

ty!

@aome510 aome510 merged commit fd4b5fd into aome510:master Jul 18, 2023
3 checks passed
@cobbinma cobbinma deleted the feat/182-create-default-app.toml branch July 18, 2023 22:00
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.

Create app.toml with default values if it doesn't exist
2 participants