Use fs_extra to get folder size
authorGreg Burri <greg.burri@gmail.com>
Wed, 23 Jun 2021 11:39:53 +0000 (13:39 +0200)
committerGreg Burri <greg.burri@gmail.com>
Wed, 23 Jun 2021 11:39:53 +0000 (13:39 +0200)
Cargo.lock
backend/Cargo.toml
backend/src/minecraft_controller.rs

index 041b868..cce0c98 100644 (file)
@@ -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",
index 139cf2f..efb9eaf 100644 (file)
@@ -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"
 
index f04ed24..13a3e3f 100644 (file)
@@ -130,7 +130,7 @@ pub fn get_minecraft_executable_information(world_path: &str, backup_path: &str,
     if processes.len() >= 1 {\r
         let process = processes.first().unwrap();\r
 \r
-        let world_size = match std::fs::metadata(world_path) { Ok(f) => f.len(), Err(_) => 0u64 };\r
+        let world_size = match fs_extra::dir::get_size(world_path) { Ok(l) => l, Err(_) => 0u64 };\r
 \r
         Some(\r
             MinecraftExe {\r