Rename version to version_made_by
Also remove System for now
This commit is contained in:
parent
078d717c7b
commit
e80213e250
3 changed files with 8 additions and 12 deletions
12
src/read.rs
12
src/read.rs
|
@ -240,7 +240,7 @@ fn central_header_to_zip_file<R: Read+io::Seek>(reader: &mut R) -> ZipResult<Zip
|
||||||
let mut result = ZipFileData
|
let mut result = ZipFileData
|
||||||
{
|
{
|
||||||
system: System::from_u8((version_made_by >> 8) as u8),
|
system: System::from_u8((version_made_by >> 8) as u8),
|
||||||
version: version_made_by as u8,
|
version_made_by: version_made_by as u8,
|
||||||
encrypted: encrypted,
|
encrypted: encrypted,
|
||||||
compression_method: CompressionMethod::from_u16(compression_method),
|
compression_method: CompressionMethod::from_u16(compression_method),
|
||||||
last_modified_time: try!(::time::Tm::from_msdos(MsDosDateTime::new(last_mod_time, last_mod_date))),
|
last_modified_time: try!(::time::Tm::from_msdos(MsDosDateTime::new(last_mod_time, last_mod_date))),
|
||||||
|
@ -288,15 +288,9 @@ impl<'a> ZipFile<'a> {
|
||||||
ZipFileReader::Bzip2(ref mut r) => r as &mut Read,
|
ZipFileReader::Bzip2(ref mut r) => r as &mut Read,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Get compatibility of the file attribute information
|
|
||||||
#[allow(dead_code)]
|
|
||||||
fn system(&self) -> System {
|
|
||||||
self.data.system
|
|
||||||
}
|
|
||||||
/// Get the version of the file
|
/// Get the version of the file
|
||||||
#[allow(dead_code)]
|
pub fn version_made_by(&self) -> (u8, u8) {
|
||||||
fn version(&self) -> u8 {
|
(self.data.version_made_by / 10, self.data.version_made_by % 10)
|
||||||
self.data.version
|
|
||||||
}
|
}
|
||||||
/// Get the name of the file
|
/// Get the name of the file
|
||||||
pub fn name(&self) -> &str {
|
pub fn name(&self) -> &str {
|
||||||
|
|
|
@ -9,6 +9,8 @@ pub enum System
|
||||||
Dos,
|
Dos,
|
||||||
Unix,
|
Unix,
|
||||||
Unknown,
|
Unknown,
|
||||||
|
#[doc(hidden)]
|
||||||
|
__Nonexhaustive,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl System {
|
impl System {
|
||||||
|
@ -32,7 +34,7 @@ pub struct ZipFileData
|
||||||
/// Compatibility of the file attribute information
|
/// Compatibility of the file attribute information
|
||||||
pub system: System,
|
pub system: System,
|
||||||
/// Specification version
|
/// Specification version
|
||||||
pub version: u8,
|
pub version_made_by: u8,
|
||||||
/// True if the file is encrypted.
|
/// True if the file is encrypted.
|
||||||
pub encrypted: bool,
|
pub encrypted: bool,
|
||||||
/// Compression method used to store the file
|
/// Compression method used to store the file
|
||||||
|
|
|
@ -135,7 +135,7 @@ impl<W: Write+io::Seek> ZipWriter<W>
|
||||||
let mut file = ZipFileData
|
let mut file = ZipFileData
|
||||||
{
|
{
|
||||||
system: System::Dos,
|
system: System::Dos,
|
||||||
version: DEFAULT_VERSION,
|
version_made_by: DEFAULT_VERSION,
|
||||||
encrypted: false,
|
encrypted: false,
|
||||||
compression_method: compression,
|
compression_method: compression,
|
||||||
last_modified_time: time::now(),
|
last_modified_time: time::now(),
|
||||||
|
@ -322,7 +322,7 @@ impl<W: Write+io::Seek> GenericZipWriter<W>
|
||||||
fn write_local_file_header<T: Write>(writer: &mut T, file: &ZipFileData) -> ZipResult<()>
|
fn write_local_file_header<T: Write>(writer: &mut T, file: &ZipFileData) -> ZipResult<()>
|
||||||
{
|
{
|
||||||
try!(writer.write_u32::<LittleEndian>(spec::LOCAL_FILE_HEADER_SIGNATURE));
|
try!(writer.write_u32::<LittleEndian>(spec::LOCAL_FILE_HEADER_SIGNATURE));
|
||||||
let version_made_by = (file.system as u16) << 8 | (file.version as u16);
|
let version_made_by = (file.system as u16) << 8 | (file.version_made_by as u16);
|
||||||
try!(writer.write_u16::<LittleEndian>(version_made_by));
|
try!(writer.write_u16::<LittleEndian>(version_made_by));
|
||||||
let flag = if !file.file_name.is_ascii() { 1u16 << 11 } else { 0 };
|
let flag = if !file.file_name.is_ascii() { 1u16 << 11 } else { 0 };
|
||||||
try!(writer.write_u16::<LittleEndian>(flag));
|
try!(writer.write_u16::<LittleEndian>(flag));
|
||||||
|
|
Loading…
Add table
Reference in a new issue