Fix creating default config #100
2 changed files with 2 additions and 29 deletions
|
@ -52,38 +52,11 @@ fn main() -> Result<()> {
|
|||
|
||||
let (action_tx, action_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
|
||||
// let config = util::config::read_config(&default_config_path, &matches)
|
||||
// .wrap_err("Failed to read config file")?;
|
||||
// let game_info = dtmt_shared::collect_game_info();
|
||||
|
||||
// tracing::debug!(?config, ?game_info);
|
||||
|
||||
// let game_dir = config.game_dir.or_else(|| game_info.map(|i| i.path));
|
||||
// if game_dir.is_none() {
|
||||
// let err =
|
||||
// eyre::eyre!("No Game Directory set. Head to the 'Settings' tab to set it manually",);
|
||||
// event_sink
|
||||
// .submit_command(ACTION_SHOW_ERROR_DIALOG, SingleUse::new(err), Target::Auto)
|
||||
// .expect("failed to send command");
|
||||
// }
|
||||
|
||||
// let initial_state = {
|
||||
// let mut state = State::new(
|
||||
// config.path,
|
||||
// game_dir.unwrap_or_default(),
|
||||
// config.data_dir.unwrap_or_default(),
|
||||
// config.nexus_api_key.unwrap_or_default(),
|
||||
// );
|
||||
// state.mods = load_mods(state.get_mod_dir(), config.mod_order.iter())
|
||||
// .wrap_err("Failed to load mods")?;
|
||||
// state
|
||||
// };
|
||||
|
||||
let config_path = matches
|
||||
.get_one::<PathBuf>("config")
|
||||
.cloned()
|
||||
.expect("argument has default value");
|
||||
let is_config_default = matches.value_source("config") != Some(ValueSource::DefaultValue);
|
||||
let is_config_default = matches.value_source("config") == Some(ValueSource::DefaultValue);
|
||||
if action_tx
|
||||
.send(AsyncAction::LoadInitial((config_path, is_config_default)))
|
||||
.is_err()
|
||||
|
|
|
@ -151,7 +151,7 @@ where
|
|||
.wrap_err("Failed to serialize default config value")?;
|
||||
fs::write(&config.path, data).await.wrap_err_with(|| {
|
||||
format!(
|
||||
"failed to write default config to {}",
|
||||
"Failed to write default config to {}",
|
||||
config.path.display()
|
||||
)
|
||||
})?;
|
||||
|
|
Loading…
Add table
Reference in a new issue