From da6e8e467b9050eb3cbb18975ad48f945f36ad53 Mon Sep 17 00:00:00 2001 From: Jaby Date: Wed, 3 Jan 2024 17:45:57 -0600 Subject: [PATCH] Support tree; Do not enforce LBA source for Overlays --- src/Tools/Tools.code-workspace | 2 +- src/Tools/psxcdgen_ex/Cargo.toml | 10 +++++----- src/Tools/psxcdgen_ex/src/types/overlay/mod.rs | 8 +++++++- src/Tools/run_cargo.bat | 6 ++++++ src/Tools/run_cargo.sh | 4 ++++ 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/Tools/Tools.code-workspace b/src/Tools/Tools.code-workspace index f45ceabe..1c34b733 100644 --- a/src/Tools/Tools.code-workspace +++ b/src/Tools/Tools.code-workspace @@ -83,7 +83,7 @@ { "id": "cargo cmd", "type":"pickString", - "options": ["build", "check", "update", "clean", "run"], + "options": ["build", "check", "update", "clean", "run", "tree"], "default": "build", "description": "cargo command to run" }, diff --git a/src/Tools/psxcdgen_ex/Cargo.toml b/src/Tools/psxcdgen_ex/Cargo.toml index fa28fb6b..c06024d5 100644 --- a/src/Tools/psxcdgen_ex/Cargo.toml +++ b/src/Tools/psxcdgen_ex/Cargo.toml @@ -8,9 +8,9 @@ panic = "abort" [dependencies] cdtypes = {path = "../cdtypes"} -clap = {version = "*", features = ["derive"]} -colored = "*" -no-comment = "*" -paste = "*" -roxmltree = "*" +clap = {version = "4.4.11", features = ["derive"]} +colored = "2.1.0" +no-comment = "0.0.3" +paste = "1.0.14" +roxmltree = "0.19.0" tool_helper = {path = "../tool_helper"} diff --git a/src/Tools/psxcdgen_ex/src/types/overlay/mod.rs b/src/Tools/psxcdgen_ex/src/types/overlay/mod.rs index 58cf1b65..6603f2d9 100644 --- a/src/Tools/psxcdgen_ex/src/types/overlay/mod.rs +++ b/src/Tools/psxcdgen_ex/src/types/overlay/mod.rs @@ -120,7 +120,13 @@ fn load_lba_names(lba_source: PathBuf) -> Result { Ok(file[start..end].to_owned()) } - let file = read_file_to_string(&lba_source)?.chars().without_comments(languages::c()).collect::(); + let file_content = { + match read_file_to_string(&lba_source) { + Ok(data) => data, + Err(_) => return Ok(LBANameVec::new()) + } + }; + let file = file_content.chars().without_comments(languages::c()).collect::(); let file = get_part_of_interest(file, &lba_source)?; let mut lba_names = Vec::new(); diff --git a/src/Tools/run_cargo.bat b/src/Tools/run_cargo.bat index 4dc7601a..8b3ddee2 100644 --- a/src/Tools/run_cargo.bat +++ b/src/Tools/run_cargo.bat @@ -55,4 +55,10 @@ IF %2 == update ( exit /B %ERRORLEVEL% ) +IF %2 == tree ( + %wsl%cargo tree + + exit /B %ERRORLEVEL% +) + echo "Unkown cargo command "%2" for project "%1" \ No newline at end of file diff --git a/src/Tools/run_cargo.sh b/src/Tools/run_cargo.sh index 2ff15971..31a8052a 100644 --- a/src/Tools/run_cargo.sh +++ b/src/Tools/run_cargo.sh @@ -37,6 +37,10 @@ elif [ $2 = update ]; then echo "cargo update $1" $HOME/.cargo/bin/cargo update + exit $? +elif [ $2 = tree ]; then + $HOME/.cargo/bin/cargo tree + exit $? else echo "Unkown cargo command $2 for project $1"