Skip to content

Commit 20839cb

Browse files
committed
feat: add explicit input for the sims directory
1 parent 6fc4351 commit 20839cb

File tree

5 files changed

+15
-29
lines changed

5 files changed

+15
-29
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ts1-compiler"
3-
version = "1.4.0"
3+
version = "1.5.0"
44
edition = "2021"
55
license = "MPL-2.0"
66

src/compiler.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::iff;
22
use crate::iff_description;
3-
use crate::the_sims;
43

54
use anyhow::Context;
65

@@ -64,7 +63,7 @@ fn get_formatted_iff_file_path_and_rename_unhashed_iff_file(
6463
Ok(iff_file_path)
6564
}
6665

67-
pub fn compile(xml_file_path: &std::path::Path) -> anyhow::Result<()> {
66+
pub fn compile(the_sims_directory: &std::path::Path, xml_file_path: &std::path::Path) -> anyhow::Result<()> {
6867
let iff_description = iff_description::IffDescription::open(xml_file_path)
6968
.with_context(|| format!("Failed to open xml file {}", xml_file_path.display()))?;
7069

@@ -79,9 +78,7 @@ pub fn compile(xml_file_path: &std::path::Path) -> anyhow::Result<()> {
7978
})?;
8079
iff_description.update_sprite_positions(source_directory)?;
8180

82-
let the_sims_install_path = the_sims::install_path()?;
83-
let input_iff_file_path =
84-
the_sims_install_path.clone().join(&iff_description.iff_file_path_relative).with_extension("iff");
81+
let input_iff_file_path = the_sims_directory.join(&iff_description.iff_file_path_relative).with_extension("iff");
8582

8683
iff::rebuild_iff_file(
8784
source_directory,
@@ -96,6 +93,7 @@ pub fn compile(xml_file_path: &std::path::Path) -> anyhow::Result<()> {
9693
}
9794

9895
pub fn compile_advanced(
96+
the_sims_directory: &std::path::Path,
9997
source_directory: &std::path::Path,
10098
format_string: &str,
10199
creator_name: &str,
@@ -115,7 +113,7 @@ pub fn compile_advanced(
115113
iff_description.update_sprite_positions(source_directory)?;
116114

117115
let (variant_original, variant_new) = variant_names.unzip();
118-
let the_sims_downloads_path = the_sims::install_path()?.join("downloads");
116+
let the_sims_downloads_path = the_sims_directory.join("downloads");
119117
let input_iff_file_path = get_formatted_iff_file_path_and_rename_unhashed_iff_file(
120118
&the_sims_downloads_path,
121119
format_string,

src/main.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ mod slot;
1111
mod splitter;
1212
mod spr;
1313
mod sprite;
14-
mod the_sims;
1514
mod xml_updater;
1615

1716
#[derive(clap::Parser)]
@@ -36,9 +35,11 @@ enum CliCommands {
3635
variant: Option<String>,
3736
},
3837
Compile {
38+
the_sims_directory: std::path::PathBuf,
3939
xml_file_path: std::path::PathBuf,
4040
},
4141
CompileAdvanced {
42+
the_sims_directory: std::path::PathBuf,
4243
source_directory: std::path::PathBuf,
4344
format_string: String,
4445
creator_name: String,
@@ -71,10 +72,14 @@ fn main() -> anyhow::Result<()> {
7172
} => {
7273
xml_updater::update(source_directory, object_name, variant.as_deref())?;
7374
}
74-
CliCommands::Compile { xml_file_path } => {
75-
compiler::compile(xml_file_path)?;
75+
CliCommands::Compile {
76+
the_sims_directory,
77+
xml_file_path,
78+
} => {
79+
compiler::compile(the_sims_directory, xml_file_path)?;
7680
}
7781
CliCommands::CompileAdvanced {
82+
the_sims_directory,
7883
source_directory,
7984
format_string,
8085
creator_name,
@@ -83,6 +88,7 @@ fn main() -> anyhow::Result<()> {
8388
variant_new,
8489
} => {
8590
compiler::compile_advanced(
91+
the_sims_directory,
8692
source_directory,
8793
format_string,
8894
creator_name,

src/the_sims.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)