this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: minor changes to the utils

+13 -3
+13 -3
src/utils.rs
··· 12 12 self.name() 13 13 } 14 14 15 + /// Detect if the input is an archive of this type 16 + #[allow(dead_code)] 17 + fn is_archive(&self, in_path: &Path) -> bool { 18 + in_path.extension().unwrap_or_default() == self.extension() 19 + } 20 + 15 21 /// Generate the default name for the compressed file 16 22 fn default_compressed_filename(&self, in_path: &Path) -> String { 17 23 format!( ··· 21 27 ) 22 28 } 23 29 24 - // Generate the default extracted filename 30 + /// Generate the default extracted filename 25 31 fn default_extracted_filename(&self, in_path: &Path) -> String { 32 + // If the file has the extension for this type, return the filename without the extension 33 + if in_path.extension().unwrap() == self.extension() { 34 + return in_path.file_stem().unwrap().to_str().unwrap().to_string(); 35 + } 26 36 // If the file has no extension, return the current directory 27 37 if in_path.extension().is_none() { 28 38 return ".".to_string(); 29 39 } 30 - // Otherwise, return the filename without the extension 31 - in_path.file_stem().unwrap().to_str().unwrap().to_string() 40 + // Otherwise, return the current directory and hope for the best 41 + ".".to_string() 32 42 } 33 43 34 44 fn compress(&self, input: CmprssInput, output: CmprssOutput) -> Result<(), io::Error> {