1
0
Fork 0
mirror of synced 2024-06-27 02:21:05 +12:00

to_string?

This commit is contained in:
xXxSuShIkiTtY420xXx 2021-10-17 12:21:11 -07:00 committed by GitHub
parent b7b270df21
commit fc08da7a88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -364,10 +364,10 @@ pub fn empty_folder_remover(tree_view: &gtk::TreeView, column_file_name: i32, co
} }
} }
let full_path = format!("{}/{}", path, name); let full_path = format!("{}/{}", path, name).to_string();
#[cfg(target_family = "windows")] #[cfg(target_family = "windows")]
let full_path = format!("{}/{}", path, name).replace("/", "\\"); let full_path = full_path.replace("/", "\\");
if !error_happened { if !error_happened {
if !use_trash { if !use_trash {
@ -386,6 +386,7 @@ pub fn empty_folder_remover(tree_view: &gtk::TreeView, column_file_name: i32, co
} }
} }
} }
if error_happened { if error_happened {
messages += format!("Failed to remove folder {} because folder doesn't exists, you don't have permissions or isn't empty.\n", full_path).as_str() messages += format!("Failed to remove folder {} because folder doesn't exists, you don't have permissions or isn't empty.\n", full_path).as_str()
} }
@ -423,10 +424,10 @@ pub fn basic_remove(tree_view: &gtk::TreeView, column_file_name: i32, column_pat
let name = model.value(&iter, column_file_name).get::<String>().unwrap(); let name = model.value(&iter, column_file_name).get::<String>().unwrap();
let path = model.value(&iter, column_path).get::<String>().unwrap(); let path = model.value(&iter, column_path).get::<String>().unwrap();
let full_path = format!("{}/{}", path, name); let full_path = format!("{}/{}", path, name).to_string();
#[cfg(target_family = "windows")] #[cfg(target_family = "windows")]
let full_path = format!("{}/{}", path, name).replace("/", "\\"); let full_path = full_path.replace("/", "\\");
if !use_trash { if !use_trash {
match fs::remove_file(full_path) { match fs::remove_file(full_path) {
@ -495,10 +496,10 @@ pub fn tree_remove(tree_view: &gtk::TreeView, column_file_name: i32, column_path
vec_file_name.sort(); vec_file_name.sort();
vec_file_name.dedup(); vec_file_name.dedup();
for file_name in vec_file_name { for file_name in vec_file_name {
let full_path = format!("{}/{}", path.clone(), file_name.clone()); let full_path = format!("{}/{}", path.clone(), file_name.clone()).to_string();
#[cfg(target_family = "windows")] #[cfg(target_family = "windows")]
let full_path = format!("{}/{}", path.clone(), file_name.clone()).replace("/", "\\"); let full_path = full_path.replace("/", "\\");
if !use_trash { if !use_trash {
if fs::remove_file(full_path).is_err() { if fs::remove_file(full_path).is_err() {