Use new substitution feature to switch between serial codes

This commit is contained in:
2024-03-21 17:23:38 -05:00
parent 0a5672ec6f
commit 064fb02cf5
7 changed files with 21 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "psxcdgen_ex"
version = "0.2.2"
version = "0.2.3"
edition = "2021"
[profile.release]

View File

@@ -1,6 +1,6 @@
[package]
name = "tool_helper"
version = "0.9.1"
version = "0.9.2"
edition = "2021"
[profile.release]

View File

@@ -213,6 +213,14 @@ pub fn input_to_vec(input: Input) -> Result<Vec<u8>, Error> {
}
pub fn read_file(file_path: &PathBuf) -> Result<Vec<u8>, Error> {
if let Some(ext) = file_path.extension() {
if ext == "subst" {
// File needs substitution!
let file_content = read_file_to_string(file_path)?;
return Ok(string_with_env_from(&file_content).into_bytes());
}
}
match std::fs::read(file_path) {
Ok(data) => Ok(data),
Err(error) => create_file_read_error(file_path, error),