From: Greg Burri Date: Wed, 23 Jun 2021 11:39:53 +0000 (+0200) Subject: Use fs_extra to get folder size X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=b18873a936be63f85a1f884fa86a60bfde241c02;p=minecraft_web.git Use fs_extra to get folder size --- diff --git a/Cargo.lock b/Cargo.lock index 041b868..cce0c98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -808,6 +808,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs_extra" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -1238,6 +1244,7 @@ dependencies = [ "cached", "chrono", "common", + "fs_extra", "futures", "itertools", "minecraft-client-rs", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 139cf2f..efb9eaf 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -13,6 +13,8 @@ minecraft-client-rs = "0.1" serde = { version = "1.0", features = ["derive"] } +fs_extra = "1.2.0" + ron = "0.6" # Rust object notation, to load configuration files. itertools = "0.10" diff --git a/backend/src/minecraft_controller.rs b/backend/src/minecraft_controller.rs index f04ed24..13a3e3f 100644 --- a/backend/src/minecraft_controller.rs +++ b/backend/src/minecraft_controller.rs @@ -130,7 +130,7 @@ pub fn get_minecraft_executable_information(world_path: &str, backup_path: &str, if processes.len() >= 1 { let process = processes.first().unwrap(); - let world_size = match std::fs::metadata(world_path) { Ok(f) => f.len(), Err(_) => 0u64 }; + let world_size = match fs_extra::dir::get_size(world_path) { Ok(l) => l, Err(_) => 0u64 }; Some( MinecraftExe {