Skip to content

Commit

Permalink
Fix: Output path is now respected
Browse files Browse the repository at this point in the history
  • Loading branch information
skairunner committed Mar 1, 2021
1 parent d814917 commit 46262ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Make sure that the input file is at the end. The file format is detected from th

|Long|Short|Description|
|----|-----|-----------|
|`--output`|`-o`|Designate the output path|
|`--output`|`-o`|Designate the output directory path|
|`--size`|`-s`|Designate how many blocks long the longest axis of the model is. Default is 1 model unit = 1 block.|
|`--scale`|`-S`|Specify a units-to-blocks ratio. Defaults to 1.|
|`--block`|`-b`|Specify what block the shell of the model will be. Defaults to stone.|
Expand Down
9 changes: 8 additions & 1 deletion src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ The largest difference between versions is pre- and post-1.13 (1241 vs 1626): th
)
.get_matches_from(env::args());

let path_prefix = matches
.value_of("output")
.map(|s| s.to_string())
.unwrap_or_default();
let path_prefix = Path::new(&path_prefix);

let config = AppConfig::from_argmatch(matches)?;

log::info!("Spawning {} threads", config.threads);
Expand All @@ -105,7 +111,8 @@ The largest difference between versions is pre- and post-1.13 (1241 vs 1626): th

// Output nbt to file.

let output_path = path.join(Path::new(&format!("{}.{}", file_stem, file_ending)));
std::fs::create_dir_all(path_prefix);
let output_path = path_prefix.join(&format!("{}.{}", file_stem, file_ending));
log::info!("Writing to '{}'", output_path.to_str().unwrap());

let mut file = File::create(output_path.clone())
Expand Down

0 comments on commit 46262ae

Please sign in to comment.