From 8230ed88e637dc25cac249044f52325c295d0c03 Mon Sep 17 00:00:00 2001 From: Ilesh Thiada Date: Tue, 1 Oct 2024 15:08:01 +0530 Subject: [PATCH] Move file picker from libium --- Cargo.lock | 287 ++++++++++++++++++++------- Cargo.toml | 10 +- src/add.rs | 3 +- src/file_picker.rs | 58 ++++++ src/main.rs | 3 +- src/subcommands/modpack/add.rs | 3 +- src/subcommands/modpack/configure.rs | 3 +- src/subcommands/modpack/mod.rs | 3 +- src/subcommands/profile/configure.rs | 2 +- src/subcommands/profile/create.rs | 2 +- src/subcommands/profile/mod.rs | 3 +- 11 files changed, 296 insertions(+), 81 deletions(-) create mode 100644 src/file_picker.rs diff --git a/Cargo.lock b/Cargo.lock index 1a8a558..88fea6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,6 +270,33 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "aws-lc-rs" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f95446d919226d587817a7d21379e6eb099b97b45110a7f272a444ca5c54070" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3ddc4a5b231dd6958b140ff3151b6412b3f4321fab354f399eec8f14b06df62" +dependencies = [ + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + [[package]] name = "backtrace" version = "0.3.74" @@ -297,6 +324,29 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash 1.1.0", + "shlex", + "syn", + "which", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -387,6 +437,15 @@ dependencies = [ "shlex", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -424,6 +483,17 @@ dependencies = [ "inout", ] +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "4.5.18" @@ -473,6 +543,15 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +[[package]] +name = "cmake" +version = "0.1.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" +dependencies = [ + "cc", +] + [[package]] name = "colorchoice" version = "1.0.2" @@ -682,6 +761,12 @@ dependencies = [ "syn", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "dyn-clone" version = "1.0.17" @@ -804,6 +889,7 @@ dependencies = [ "octocrab", "rand", "reqwest", + "rfd", "serde_json", "size", "tokio", @@ -1005,6 +1091,12 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "h2" version = "0.4.6" @@ -1132,25 +1224,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" -dependencies = [ - "futures-util", - "http", - "hyper", - "hyper-util", - "log", - "rustls 0.22.4", - "rustls-native-certs", - "rustls-pki-types", - "tokio", - "tokio-rustls 0.25.0", - "tower-service", -] - [[package]] name = "hyper-rustls" version = "0.27.3" @@ -1161,10 +1234,12 @@ dependencies = [ "http", "hyper", "hyper-util", - "rustls 0.23.13", + "log", + "rustls", + "rustls-native-certs", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.0", + "tokio-rustls", "tower-service", "webpki-roots", ] @@ -1314,6 +1389,15 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -1382,6 +1466,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.159" @@ -1391,7 +1481,7 @@ checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libium" version = "1.32.0" -source = "git+https://github.com/gorilla-devs/libium?rev=2fe13808755141b6169ed32013198a7ccfdf109b#2fe13808755141b6169ed32013198a7ccfdf109b" +source = "git+https://github.com/gorilla-devs/libium?rev=0e297821e536f3e83790fbd784a916b2bcdb1cc2#0e297821e536f3e83790fbd784a916b2bcdb1cc2" dependencies = [ "clap", "derive_more", @@ -1399,11 +1489,9 @@ dependencies = [ "furse", "futures-util", "home", - "inquire", "octocrab", "regex", "reqwest", - "rfd", "serde", "serde_json", "sha1", @@ -1413,6 +1501,16 @@ dependencies = [ "zip-extensions", ] +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets 0.52.6", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -1481,6 +1579,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.8.0" @@ -1514,6 +1618,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + [[package]] name = "murmur2" version = "0.1.0" @@ -1542,6 +1652,16 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "num-bigint" version = "0.4.6" @@ -1622,9 +1742,9 @@ dependencies = [ [[package]] name = "octocrab" -version = "0.40.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09386c28b984097d7a56ec23907bb76751ae6720ebdc4484fe2a705c95d5b77d" +checksum = "5dada65f156e4100376ceeaeadae1b4d35ab9cdf4236cfc92fde0d06b930c3b7" dependencies = [ "arc-swap", "async-trait", @@ -1639,7 +1759,7 @@ dependencies = [ "http-body", "http-body-util", "hyper", - "hyper-rustls 0.26.0", + "hyper-rustls", "hyper-timeout", "hyper-util", "jsonwebtoken", @@ -1653,7 +1773,7 @@ dependencies = [ "serde_urlencoded", "snafu", "tokio", - "tower", + "tower 0.4.13", "tower-http", "tracing", "url", @@ -1713,6 +1833,12 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "pbkdf2" version = "0.12.2" @@ -1830,6 +1956,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro-crate" version = "3.2.0" @@ -1858,8 +1994,8 @@ dependencies = [ "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash", - "rustls 0.23.13", + "rustc-hash 2.0.0", + "rustls", "socket2", "thiserror", "tokio", @@ -1875,8 +2011,8 @@ dependencies = [ "bytes", "rand", "ring", - "rustc-hash", - "rustls 0.23.13", + "rustc-hash 2.0.0", + "rustls", "slab", "thiserror", "tinyvec", @@ -1994,7 +2130,7 @@ dependencies = [ "http-body", "http-body-util", "hyper", - "hyper-rustls 0.27.3", + "hyper-rustls", "hyper-util", "ipnet", "js-sys", @@ -2004,16 +2140,16 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.13", + "rustls", "rustls-pemfile", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.1", "system-configuration", "tokio", - "tokio-rustls 0.26.0", + "tokio-rustls", "tower-service", "url", "wasm-bindgen", @@ -2067,6 +2203,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc-hash" version = "2.0.0" @@ -2086,26 +2228,14 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" -dependencies = [ - "log", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - [[package]] name = "rustls" version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ + "aws-lc-rs", + "log", "once_cell", "ring", "rustls-pki-types", @@ -2116,9 +2246,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -2148,6 +2278,7 @@ version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ + "aws-lc-rs", "ring", "rustls-pki-types", "untrusted", @@ -2423,6 +2554,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "sync_wrapper" version = "1.0.1" @@ -2571,24 +2708,13 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-rustls" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" -dependencies = [ - "rustls 0.22.4", - "rustls-pki-types", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.13", + "rustls", "rustls-pki-types", "tokio", ] @@ -2640,21 +2766,34 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", +] + [[package]] name = "tower-http" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +checksum = "8437150ab6bbc8c5f0f519e3d5ed4aa883a83dd4cdd3d1b21f9482936046cb97" dependencies = [ "bitflags 2.6.0", "bytes", "futures-util", "http", "http-body", - "http-body-util", "iri-string", "pin-project-lite", - "tower", + "tower 0.5.1", "tower-layer", "tower-service", "tracing", @@ -2903,6 +3042,18 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index f54c637..cbe0ac4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,10 +35,14 @@ exclude = [".github", "tests", "media"] default = ["gui"] # Replaces the CLI text input with a GUI file dialogue for picking folders -gui = ["libium/gui"] +gui = ["rfd"] [dependencies] +rfd = { version = "0.14", optional = true, default-features = false, features = [ + "xdg-portal", + "tokio", +] } reqwest = { version = "0.12", default-features = false, features = [ "macos-system-configuration", "rustls-tls", @@ -52,13 +56,13 @@ clap = { version = "4.5", features = ["derive"] } clap_complete = "4.5" serde_json = "1.0" indicatif = "0.17" -octocrab = "0.40" +octocrab = "0.41" fs_extra = "1.3" ferinth = "2.11" colored = "2.1" futures = "0.3" inquire = "0.7" -libium = { git = "https://github.com/gorilla-devs/libium", rev = "2fe13808755141b6169ed32013198a7ccfdf109b" } +libium = { git = "https://github.com/gorilla-devs/libium", rev = "0e297821e536f3e83790fbd784a916b2bcdb1cc2" } # libium = { path = "../libium" } # libium = "1.32" anyhow = "1.0" diff --git a/src/add.rs b/src/add.rs index 3c3808f..04832a0 100644 --- a/src/add.rs +++ b/src/add.rs @@ -1,7 +1,6 @@ -use std::collections::HashMap; - use colored::Colorize as _; use libium::{add::Error, iter_ext::IterExt as _}; +use std::collections::HashMap; pub fn display_successes_failures(successes: &[String], failures: Vec<(String, Error)>) -> bool { if !successes.is_empty() { diff --git a/src/file_picker.rs b/src/file_picker.rs new file mode 100644 index 0000000..d919daa --- /dev/null +++ b/src/file_picker.rs @@ -0,0 +1,58 @@ +use libium::HOME; +use std::{ + io::Result, + path::{Path, PathBuf}, +}; + +#[cfg(feature = "gui")] +/// Uses the system file picker to pick a file, with a `default` path +fn show_folder_picker(default: impl AsRef, prompt: impl Into) -> Option { + rfd::FileDialog::new() + .set_can_create_directories(true) + .set_directory(default) + .set_title(prompt) + .pick_folder() +} + +#[cfg(not(feature = "gui"))] +/// Uses a terminal input to pick a file, with a `default` path +fn show_folder_picker(default: impl AsRef, prompt: impl Into) -> Option { + inquire::Text::new(&prompt.into()) + .with_default(&default.as_ref().display().to_string()) + .prompt() + .ok() + .map(Into::into) +} + +/// Picks a folder using the terminal or system file picker (depending on the feature flag `gui`) +/// +/// The `default` path is shown/opened at first and the `name` is what folder the user is supposed to be picking (e.g. output directory) +pub fn pick_folder( + default: impl AsRef, + prompt: impl Into, + name: impl AsRef, +) -> Result> { + show_folder_picker(default, prompt) + .map(|raw_in| { + let path = raw_in + .components() + .map(|c| { + if c.as_os_str() == "~" { + HOME.as_os_str() + } else { + c.as_os_str() + } + }) + .collect::() + .canonicalize()?; + + println!( + "✔ \x1b[01m{}\x1b[0m · \x1b[32m{}\x1b[0m", + name.as_ref(), + path.display(), + ); + + Ok(path) + }) + .transpose() +} diff --git a/src/main.rs b/src/main.rs index 94e5f65..320f63c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,7 @@ mod add; mod cli; mod download; +mod file_picker; mod subcommands; use anyhow::{anyhow, bail, ensure, Result}; @@ -65,7 +66,7 @@ fn main() -> ExitCode { #[cfg(windows)] // Enable colours on conhost (command prompt or powershell) { - #[expect(clippy::unwrap_used)] // There is actually no error + #[expect(clippy::unwrap_used, reason = "There is actually no error")] colored::control::set_virtual_terminal(true).unwrap(); } diff --git a/src/subcommands/modpack/add.rs b/src/subcommands/modpack/add.rs index 00be6eb..2fd3156 100644 --- a/src/subcommands/modpack/add.rs +++ b/src/subcommands/modpack/add.rs @@ -1,11 +1,10 @@ use super::check_output_directory; -use crate::TICK; +use crate::{file_picker::pick_folder, TICK}; use anyhow::{Context as _, Result}; use colored::Colorize as _; use inquire::Confirm; use libium::{ config::structs::{Config, Modpack, ModpackIdentifier}, - file_picker::pick_folder, get_minecraft_dir, iter_ext::IterExt as _, modpack::add, diff --git a/src/subcommands/modpack/configure.rs b/src/subcommands/modpack/configure.rs index 1d1cb56..2d4bf8c 100644 --- a/src/subcommands/modpack/configure.rs +++ b/src/subcommands/modpack/configure.rs @@ -1,8 +1,9 @@ use super::check_output_directory; +use crate::file_picker::pick_folder; use anyhow::Result; use colored::Colorize as _; use inquire::Confirm; -use libium::{config::structs::Modpack, file_picker::pick_folder}; +use libium::config::structs::Modpack; use std::path::PathBuf; pub fn configure( diff --git a/src/subcommands/modpack/mod.rs b/src/subcommands/modpack/mod.rs index a3cf19b..0578237 100644 --- a/src/subcommands/modpack/mod.rs +++ b/src/subcommands/modpack/mod.rs @@ -10,10 +10,11 @@ pub use info::info; pub use switch::switch; pub use upgrade::upgrade; +use crate::file_picker::pick_folder; use anyhow::{ensure, Context as _, Result}; use fs_extra::dir::{copy, CopyOptions}; use inquire::Confirm; -use libium::{file_picker::pick_folder, HOME}; +use libium::HOME; use std::{fs::read_dir, path::Path}; pub fn check_output_directory(output_dir: &Path) -> Result<()> { diff --git a/src/subcommands/profile/configure.rs b/src/subcommands/profile/configure.rs index 60007f7..67bdb86 100644 --- a/src/subcommands/profile/configure.rs +++ b/src/subcommands/profile/configure.rs @@ -1,10 +1,10 @@ use super::{check_output_directory, pick_minecraft_versions, pick_mod_loader}; +use crate::file_picker::pick_folder; use anyhow::{Context as _, Result}; use inquire::{Select, Text}; use libium::{ config::filters::ProfileParameters as _, config::structs::{ModLoader, Profile}, - file_picker::pick_folder, }; use std::path::PathBuf; diff --git a/src/subcommands/profile/create.rs b/src/subcommands/profile/create.rs index 1756797..8491490 100644 --- a/src/subcommands/profile/create.rs +++ b/src/subcommands/profile/create.rs @@ -1,4 +1,5 @@ use super::{check_output_directory, pick_minecraft_versions, pick_mod_loader}; +use crate::file_picker::pick_folder; use anyhow::{bail, ensure, Context as _, Result}; use colored::Colorize as _; use inquire::{ @@ -7,7 +8,6 @@ use inquire::{ }; use libium::{ config::structs::{Config, ModLoader, Profile}, - file_picker::pick_folder, get_minecraft_dir, iter_ext::IterExt as _, }; diff --git a/src/subcommands/profile/mod.rs b/src/subcommands/profile/mod.rs index 5fc5427..6c3bb46 100644 --- a/src/subcommands/profile/mod.rs +++ b/src/subcommands/profile/mod.rs @@ -9,12 +9,13 @@ pub use delete::delete; pub use info::info; pub use switch::switch; +use crate::file_picker::pick_folder; use anyhow::{ensure, Context as _, Result}; use colored::Colorize as _; use ferinth::Ferinth; use fs_extra::dir::{copy, CopyOptions}; use inquire::{Confirm, MultiSelect, Select}; -use libium::{config::structs::ModLoader, file_picker::pick_folder, iter_ext::IterExt as _, HOME}; +use libium::{config::structs::ModLoader, iter_ext::IterExt as _, HOME}; use std::{ fs::{create_dir_all, read_dir}, path::PathBuf,