1use anyhow::{anyhow, Result};
2use serde::Deserialize;
3use std::path::PathBuf;
4
5#[derive(Deserialize)]
7pub struct FoundryConfig {
8 pub profile: Profile,
10}
11
12#[derive(Deserialize)]
14pub struct Profile {
15 pub default: ProfileSettings,
17}
18
19#[derive(Deserialize)]
21pub struct ProfileSettings {
22 pub out: Option<String>,
24}
25
26pub fn find_up(filename: &str) -> Result<PathBuf> {
28 let mut path = std::env::current_dir()?;
29 loop {
30 let candidate = path.join(filename);
31 if candidate.exists() {
32 return Ok(candidate);
33 }
34 if !path.pop() {
35 return Err(anyhow!(
36 "Could not find {} in current or parent directories",
37 filename
38 ));
39 }
40 }
41}