Skip to content

Commit

Permalink
feat: provide script location for extract
Browse files Browse the repository at this point in the history
  • Loading branch information
francisdb committed Dec 18, 2024
1 parent 8e106b1 commit 9d20561
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 207 deletions.
131 changes: 19 additions & 112 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ dialoguer = { version = "0.11.0", features = ["fuzzy-select"] }
dirs = "5.0.1"
git-version = "0.3.9"
indicatif = "0.17.9"
log = "0.4.22"
logging_timer = "1.1.1"
pretty_env_logger = "0.5.0"
quick-xml = { version = "0.37.1", features = ["serialize"] }
serde = { version = "1.0.216", features = ["derive"] }
serde_json = { version = "1.0.133", features = ["preserve_order"] }
shellexpand = "3.1.0"
Expand All @@ -38,15 +34,14 @@ figment = { version = "0.10", features = ["toml", "env"] }
toml = "0.8.19"
is_executable = "1.0.4"
regex = { version = "1.11.1", features = [] }
vpin = { version = "0.17.0" }
vpin = { version = "0.17.1" }
rust-ini = "0.21.1"
edit = "0.1.5"
jojodiff = "0.1.2"
pinmame-nvram = "0.3.3"

[dev-dependencies]
pretty_assertions = "1.4.1"
rand = "0.8.5"
testdir = "0.9.3"

[profile.test]
Expand Down
12 changes: 7 additions & 5 deletions src/frontend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ fn table_menu(
let result = if path.exists() {
open_editor(&path, Some(config))
} else {
extractvbs(selected_path, false, None)
extractvbs(selected_path, None, false)
.and_then(|_| open_editor(&path, Some(config)))
};
match result {
Expand All @@ -287,7 +287,7 @@ fn table_menu(
}
}
}
Some(TableOption::ExtractVBS) => match extractvbs(selected_path, false, None) {
Some(TableOption::ExtractVBS) => match extractvbs(selected_path, None, false) {
Ok(ExtractResult::Extracted(path)) => {
prompt(format!("VBS extracted to {}", path.to_string_lossy()));
}
Expand All @@ -310,7 +310,7 @@ fn table_menu(
}
},
Some(TableOption::PatchVBS) => {
let vbs_path = match extractvbs(selected_path, false, Some("vbs")) {
let vbs_path = match extractvbs(selected_path, None, false) {
Ok(ExtractResult::Existed(path)) => path,
Ok(ExtractResult::Extracted(path)) => path,
Err(err) => {
Expand Down Expand Up @@ -340,7 +340,8 @@ fn table_menu(
}
}
Some(TableOption::UnifyLineEndings) => {
let vbs_path = match extractvbs(selected_path, false, Some("vbs")) {
let vbs_path = vbs_path_for(selected_path);
let vbs_path = match extractvbs(selected_path, Some(vbs_path), false) {
Ok(ExtractResult::Existed(path)) => path,
Ok(ExtractResult::Extracted(path)) => path,
Err(err) => {
Expand All @@ -366,7 +367,8 @@ fn table_menu(
}
}
Some(TableOption::CreateVBSPatch) => {
let original_path = match extractvbs(selected_path, true, Some("vbs.original")) {
let vbs_path = selected_path.with_extension("vbs.original");
let original_path = match extractvbs(selected_path, Some(vbs_path), true) {
Ok(ExtractResult::Existed(path)) => path,
Ok(ExtractResult::Extracted(path)) => path,
Err(err) => {
Expand Down
Loading

0 comments on commit 9d20561

Please sign in to comment.