Skip to content

Commit

Permalink
Fix config.toml default location
Browse files Browse the repository at this point in the history
  • Loading branch information
ambiguousname committed Feb 4, 2025
1 parent 206212d commit 3e2b2d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ struct Opt {

/// The path to an optional config file to override code generation defaults.
/// This is where [`config::Config`] is filled in.
#[clap(short, long, value_parser)]
config_file: Option<PathBuf>,
///
/// We assume by default that this is located in the root directory.
#[clap(short, long, value_parser, default_value = "config.toml")]
config_file: PathBuf,

#[clap(short = 's', long)]
silent: bool,
Expand All @@ -39,9 +41,7 @@ fn main() -> std::io::Result<()> {

// -- Config Parsing --

// We assume by default that this is located in the directory with all other source files:
let default_pth = opt.entry.join("../config.toml");
let path = opt.config_file.as_deref().unwrap_or(&default_pth);
let path = opt.config_file;
let config: Config = if path.exists() {
let file_buf = std::fs::read(path)?;
toml::from_slice(&file_buf)?
Expand Down

0 comments on commit 3e2b2d2

Please sign in to comment.