From 4ce0e210bdefaa163c60b1860df4e06d1a0fad56 Mon Sep 17 00:00:00 2001 From: Tangtang Zhou Date: Sat, 18 May 2024 17:55:04 +0200 Subject: [PATCH] feat: implement unpack write files --- src/main.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3256209..a5d5a1a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,7 +61,7 @@ pub enum Error { StripPrefix(#[from] ::std::path::StripPrefixError), #[error("{0} is not a directory")] NotDir(PathBuf), - #[error("output file path already exists: {0}")] + #[error("output path already exists: {0}")] OutputPathExists(PathBuf), #[error("{0} has invalid unicode")] InvalidUnicode(PathBuf), @@ -75,6 +75,8 @@ pub enum Error { InvalidFileFlags(i32), #[error("utf16 error {0}")] Utf16Error(String), + #[error("parten file path does not exists: {0}")] + ParentPathDoesNotExist(PathBuf), } impl From>> for Error { @@ -207,6 +209,9 @@ fn unpack_archive(iro_path: PathBuf, output_path: Option) -> Result) -> Result) -> Result Result { let bytes_u16 = path_bytes .chunks(2) - .map(|e| e.try_into().map(u16::from_be_bytes)) + .map(|e| e.try_into().map(u16::from_le_bytes)) .collect::, _>>() .map_err(|_| Error::Utf16Error("uneven bytes".to_owned()))?;