Small tweak in message passing
This commit is contained in:
parent
3d0151610d
commit
0a94691685
@ -5,7 +5,7 @@ use {
|
||||
borrow::BorrowMut,
|
||||
env,
|
||||
error::Error,
|
||||
fs::{File, self},
|
||||
fs::{self, File},
|
||||
io::{self, Write},
|
||||
path::{Path, PathBuf},
|
||||
sync::{
|
||||
@ -97,10 +97,7 @@ impl Creator {
|
||||
plist.lock().unwrap().borrow_mut().entries.push(item.entry);
|
||||
match writer.lock().unwrap().borrow_mut().write_all(&item.data) {
|
||||
Ok(_) => sender
|
||||
.send(Message::MemberAdded(format!(
|
||||
"{} added to archive",
|
||||
path.display()
|
||||
)))
|
||||
.send(Message::MemberAdded(format!("{}", path.display())))
|
||||
.expect("couldn't send message"),
|
||||
Err(e) => sender
|
||||
.send(Message::Failure(format!("{e}")))
|
||||
|
@ -5,8 +5,10 @@ use std::{
|
||||
ffi::CStr,
|
||||
fmt::{self, Write},
|
||||
fs::{self, Metadata},
|
||||
io,
|
||||
ops::Deref,
|
||||
os::{linux::fs::MetadataExt, unix::fs::FileTypeExt}, path::PathBuf, io,
|
||||
os::{linux::fs::MetadataExt, unix::fs::FileTypeExt},
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
#[repr(u8)]
|
||||
@ -225,11 +227,21 @@ impl Header {
|
||||
let path = PathBuf::from(&filename);
|
||||
let name = match path.file_name().and_then(|n| n.to_str()) {
|
||||
Some(n) => n.to_string(),
|
||||
None => return Err(Error::Io(io::Error::new(io::ErrorKind::Other, "Cannot get file name"))),
|
||||
None => {
|
||||
return Err(Error::Io(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"Cannot get file name",
|
||||
)))
|
||||
}
|
||||
};
|
||||
let dir = match path.parent() {
|
||||
Some(d) => d,
|
||||
None => return Err(Error::Io(io::Error::new(io::ErrorKind::Other, "Cannot get path prefix"))),
|
||||
None => {
|
||||
return Err(Error::Io(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"Cannot get path prefix",
|
||||
)))
|
||||
}
|
||||
};
|
||||
(name, Some(format!("{}", dir.display())))
|
||||
};
|
||||
@ -288,11 +300,21 @@ impl Header {
|
||||
let path = PathBuf::from(&filename);
|
||||
let name = match path.file_name().and_then(|n| n.to_str()) {
|
||||
Some(n) => n.to_string(),
|
||||
None => return Err(Error::Io(io::Error::new(io::ErrorKind::Other, "Cannot get file name"))),
|
||||
None => {
|
||||
return Err(Error::Io(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"Cannot get file name",
|
||||
)))
|
||||
}
|
||||
};
|
||||
let dir = match path.parent() {
|
||||
Some(d) => d,
|
||||
None => return Err(Error::Io(io::Error::new(io::ErrorKind::Other, "Cannot get path prefix"))),
|
||||
None => {
|
||||
return Err(Error::Io(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"Cannot get path prefix",
|
||||
)))
|
||||
}
|
||||
};
|
||||
(name, Some(format!("{}", dir.display())))
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user