quick cleanup to some untranslated strings, moving zip extract dir creation order
This commit is contained in:
parent
22552c658f
commit
a4d7a377d3
3 changed files with 28 additions and 7 deletions
|
|
@ -39,6 +39,9 @@ resume = Resume
|
||||||
## Compress Dialog
|
## Compress Dialog
|
||||||
create-archive = Create archive
|
create-archive = Create archive
|
||||||
|
|
||||||
|
## Extract Dialog
|
||||||
|
extract-password-required = Password required
|
||||||
|
|
||||||
## Empty Trash Dialog
|
## Empty Trash Dialog
|
||||||
empty-trash = Empty trash
|
empty-trash = Empty trash
|
||||||
empty-trash-warning = Are you sure you want to permanently delete all the items in Trash?
|
empty-trash-warning = Are you sure you want to permanently delete all the items in Trash?
|
||||||
|
|
|
||||||
|
|
@ -3677,7 +3677,7 @@ impl Application for App {
|
||||||
let password_unwrapped = password.clone().unwrap_or_else(String::default);
|
let password_unwrapped = password.clone().unwrap_or_else(String::default);
|
||||||
dialog = dialog.control(
|
dialog = dialog.control(
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
widget::text::body("Password").into(),
|
widget::text::body(fl!("password")).into(),
|
||||||
widget::text_input("", password_unwrapped).password().on_input(move |password_unwrapped| {
|
widget::text_input("", password_unwrapped).password().on_input(move |password_unwrapped| {
|
||||||
Message::DialogUpdate(DialogPage::Compress {
|
Message::DialogUpdate(DialogPage::Compress {
|
||||||
paths: paths.clone(),
|
paths: paths.clone(),
|
||||||
|
|
@ -3723,7 +3723,7 @@ impl Application for App {
|
||||||
password
|
password
|
||||||
} => {
|
} => {
|
||||||
widget::dialog()
|
widget::dialog()
|
||||||
.title("Password required")
|
.title(fl!("extract-password-required"))
|
||||||
.icon(widget::icon::from_name("dialog-error").size(64))
|
.icon(widget::icon::from_name("dialog-error").size(64))
|
||||||
.control(widget::text_input("", password).password().on_input(move |password| {
|
.control(widget::text_input("", password).password().on_input(move |password| {
|
||||||
Message::DialogUpdate(DialogPage::ExtractPassword {
|
Message::DialogUpdate(DialogPage::ExtractPassword {
|
||||||
|
|
@ -3732,7 +3732,7 @@ impl Application for App {
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
.primary_action(
|
.primary_action(
|
||||||
widget::button::suggested(fl!("create")).on_press(Message::DialogComplete),
|
widget::button::suggested(fl!("extract-here")).on_press(Message::DialogComplete),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
DialogPage::MountError {
|
DialogPage::MountError {
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,8 @@ fn zip_extract<R: io::Read + io::Seek, P: AsRef<Path>>(
|
||||||
let mut files_by_unix_mode = Vec::new();
|
let mut files_by_unix_mode = Vec::new();
|
||||||
let mut buffer = vec![0; 4 * 1024 * 1024];
|
let mut buffer = vec![0; 4 * 1024 * 1024];
|
||||||
let total_files = archive.len();
|
let total_files = archive.len();
|
||||||
|
let mut pending_directory_creates = Vec::new();
|
||||||
|
|
||||||
for i in 0..total_files {
|
for i in 0..total_files {
|
||||||
controller
|
controller
|
||||||
.check()
|
.check()
|
||||||
|
|
@ -137,7 +139,7 @@ fn zip_extract<R: io::Read + io::Seek, P: AsRef<Path>>(
|
||||||
let outpath = directory.as_ref().join(filepath);
|
let outpath = directory.as_ref().join(filepath);
|
||||||
|
|
||||||
if file.is_dir() {
|
if file.is_dir() {
|
||||||
make_writable_dir_all(&outpath)?;
|
pending_directory_creates.push(outpath.clone());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let symlink_target = if file.is_symlink() && (cfg!(unix) || cfg!(windows)) {
|
let symlink_target = if file.is_symlink() && (cfg!(unix) || cfg!(windows)) {
|
||||||
|
|
@ -148,10 +150,16 @@ fn zip_extract<R: io::Read + io::Seek, P: AsRef<Path>>(
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
drop(file);
|
drop(file);
|
||||||
if let Some(p) = outpath.parent() {
|
|
||||||
make_writable_dir_all(p)?;
|
|
||||||
}
|
|
||||||
if let Some(target) = symlink_target {
|
if let Some(target) = symlink_target {
|
||||||
|
// create all pending dirs
|
||||||
|
while let Some(pending_dir) = pending_directory_creates.pop() {
|
||||||
|
make_writable_dir_all(pending_dir)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(p) = outpath.parent() {
|
||||||
|
make_writable_dir_all(p)?;
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
use std::os::unix::ffi::OsStringExt;
|
use std::os::unix::ffi::OsStringExt;
|
||||||
|
|
@ -186,6 +194,16 @@ fn zip_extract<R: io::Read + io::Seek, P: AsRef<Path>>(
|
||||||
None => archive.by_index(i),
|
None => archive.by_index(i),
|
||||||
Some(pwd) => archive.by_index_decrypt(i, pwd.as_bytes())
|
Some(pwd) => archive.by_index_decrypt(i, pwd.as_bytes())
|
||||||
}.map_err(|e| e)?;
|
}.map_err(|e| e)?;
|
||||||
|
|
||||||
|
// create all pending dirs
|
||||||
|
while let Some(pending_dir) = pending_directory_creates.pop() {
|
||||||
|
make_writable_dir_all(pending_dir)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(p) = outpath.parent() {
|
||||||
|
make_writable_dir_all(p)?;
|
||||||
|
}
|
||||||
|
|
||||||
let total = file.size();
|
let total = file.size();
|
||||||
let mut outfile = fs::File::create(&outpath)?;
|
let mut outfile = fs::File::create(&outpath)?;
|
||||||
let mut current = 0;
|
let mut current = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue