feat(dtmt): Fail early in mod migration
This commit is contained in:
parent
21d95e492c
commit
2014c3b187
1 changed files with 6 additions and 9 deletions
|
@ -309,6 +309,12 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()>
|
||||||
|
|
||||||
let out_dir = out_dir.join(&mod_file.id);
|
let out_dir = out_dir.join(&mod_file.id);
|
||||||
|
|
||||||
|
fs::create_dir(&out_dir)
|
||||||
|
.await
|
||||||
|
.wrap_err_with(|| format!("Failed to create mod directory '{}'", out_dir.display()))?;
|
||||||
|
|
||||||
|
tracing::info!("Created mod directory '{}'", out_dir.display());
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"Enter additional information about your mod '{}'!",
|
"Enter additional information about your mod '{}'!",
|
||||||
&mod_file.id
|
&mod_file.id
|
||||||
|
@ -348,15 +354,6 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()>
|
||||||
|
|
||||||
tracing::debug!(?dtmt_cfg);
|
tracing::debug!(?dtmt_cfg);
|
||||||
|
|
||||||
fs::create_dir(&dtmt_cfg.dir).await.wrap_err_with(|| {
|
|
||||||
format!(
|
|
||||||
"Failed to create mod directory '{}'",
|
|
||||||
dtmt_cfg.dir.display()
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
|
|
||||||
tracing::info!("Created mod directory '{}'", dtmt_cfg.dir.display());
|
|
||||||
|
|
||||||
{
|
{
|
||||||
let path = dtmt_cfg.dir.join("dtmt.cfg");
|
let path = dtmt_cfg.dir.join("dtmt.cfg");
|
||||||
let data = serde_sjson::to_string(&dtmt_cfg).wrap_err("Failed to serialize dtmt.cfg")?;
|
let data = serde_sjson::to_string(&dtmt_cfg).wrap_err("Failed to serialize dtmt.cfg")?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue