-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from tamada/20240514
implement done
- Loading branch information
Showing
24 changed files
with
957 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#[cfg(target_os = "windows")] | ||
pub mod windows; | ||
|
||
#[cfg(any(target_os = "linux", target_os = "macos"))] | ||
pub mod linux; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::os::unix::fs::PermissionsExt; | ||
use std::path::PathBuf; | ||
|
||
use time::OffsetDateTime; | ||
use zip::write::SimpleFileOptions; | ||
use zip::DateTime; | ||
|
||
pub fn create(target: &PathBuf) -> SimpleFileOptions { | ||
let metadata = std::fs::metadata(&target).unwrap(); | ||
let mod_time = DateTime::try_from( | ||
OffsetDateTime::from(metadata.modified().unwrap())); | ||
|
||
SimpleFileOptions::default() | ||
.last_modified_time(mod_time.unwrap()) | ||
.compression_method(zip::CompressionMethod::Stored) | ||
.unix_permissions(metadata.permissions().mode()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pub fn create(target: &PathBuf) -> SimpleFileOptions { | ||
let metadata = std::fs::metadata(&target).unwrap(); | ||
let mod_time = DateTime::try_from( | ||
OffsetDateTime::from(metadata.modified().unwrap())); | ||
|
||
SimpleFileOptions::default() | ||
.last_modified_time(mod_time.unwrap()) | ||
.compression_method(zip::CompressionMethod::Stored) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use crate::archiver::{Archiver, Format, ArchiverOpts}; | ||
use crate::cli::{ToatError, Result}; | ||
|
||
pub(super) struct RarArchiver { | ||
} | ||
|
||
impl Archiver for RarArchiver { | ||
fn perform(&self, _: ArchiverOpts) -> Result<()> { | ||
Err(ToatError::UnsupportedFormat("only extraction support for rar".to_string())) | ||
} | ||
fn format(&self) -> Format { | ||
Format::Rar | ||
} | ||
} |
Oops, something went wrong.