From 49cb62b1baf5dd3240be3f05de0a451d11830a61 Mon Sep 17 00:00:00 2001 From: crumblingstatue Date: Tue, 18 Jun 2024 22:17:21 +0200 Subject: [PATCH] Replace `directories-next` dependency with `directories` (#4661) `directories-next` was created because `directories` was not maintained at the time. However, `directories` has gotten active maintainership since, and it has received more updates than `directories-next`. `directories` also has more recent downloads than its `next` counterpart, so it might make sense to switch to it, to avoid unnecessary duplicate dependencies, where a project depends transitively on both `directories` and `directories-next`. The main question is whether we depend on any specific behavior from `directories-next`. --- Cargo.lock | 26 +++++++++++++++--------- crates/eframe/Cargo.toml | 4 ++-- crates/eframe/src/epi.rs | 2 +- crates/eframe/src/native/file_storage.rs | 4 ++-- deny.toml | 2 +- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 28307f76e68..6f2de1d9f2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1107,24 +1107,24 @@ dependencies = [ ] [[package]] -name = "directories-next" -version = "2.0.0" +name = "directories" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" dependencies = [ - "cfg-if", - "dirs-sys-next", + "dirs-sys", ] [[package]] -name = "dirs-sys-next" -version = "0.1.2" +name = "dirs-sys" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" dependencies = [ "libc", + "option-ext", "redox_users", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -1175,7 +1175,7 @@ version = "0.27.2" dependencies = [ "ahash", "bytemuck", - "directories-next", + "directories", "document-features", "egui", "egui-wgpu", @@ -2669,6 +2669,12 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "orbclient" version = "0.3.46" diff --git a/crates/eframe/Cargo.toml b/crates/eframe/Cargo.toml index acd7600f6e6..bb244b38782 100644 --- a/crates/eframe/Cargo.toml +++ b/crates/eframe/Cargo.toml @@ -70,7 +70,7 @@ glow = [ ## Enable saving app state to disk. persistence = [ - "directories-next", + "directories", "egui-winit/serde", "egui/persistence", "ron", @@ -159,7 +159,7 @@ image = { workspace = true, features = ["png"] } # Needed for app icon winit = { workspace = true, default-features = false, features = ["rwh_06"] } # optional native: -directories-next = { version = "2", optional = true } +directories = { version = "5", optional = true } egui-wgpu = { workspace = true, optional = true, features = [ "winit", ] } # if wgpu is used, use it with winit diff --git a/crates/eframe/src/epi.rs b/crates/eframe/src/epi.rs index ac6585c3d18..4a05c97aaf2 100644 --- a/crates/eframe/src/epi.rs +++ b/crates/eframe/src/epi.rs @@ -367,7 +367,7 @@ pub struct NativeOptions { pub persist_window: bool, /// The folder where `eframe` will store the app state. If not set, eframe will get the paths - /// from [directories_next]. + /// from [directories]. pub persistence_path: Option, } diff --git a/crates/eframe/src/native/file_storage.rs b/crates/eframe/src/native/file_storage.rs index 970c35a4f41..fb27642b42e 100644 --- a/crates/eframe/src/native/file_storage.rs +++ b/crates/eframe/src/native/file_storage.rs @@ -10,12 +10,12 @@ use std::{ /// [`egui::ViewportBuilder::app_id`] of [`crate::NativeOptions::viewport`] /// or the title argument to [`crate::run_native`]. /// -/// On native the path is picked using [`directories_next::ProjectDirs::data_dir`](https://docs.rs/directories-next/2.0.0/directories_next/struct.ProjectDirs.html#method.data_dir) which is: +/// On native the path is picked using [`directories::ProjectDirs::data_dir`](https://docs.rs/directories/5.0.1/directories/struct.ProjectDirs.html#method.data_dir) which is: /// * Linux: `/home/UserName/.local/share/APP_ID` /// * macOS: `/Users/UserName/Library/Application Support/APP_ID` /// * Windows: `C:\Users\UserName\AppData\Roaming\APP_ID` pub fn storage_dir(app_id: &str) -> Option { - directories_next::ProjectDirs::from("", "", app_id) + directories::ProjectDirs::from("", "", app_id) .map(|proj_dirs| proj_dirs.data_dir().to_path_buf()) } diff --git a/deny.toml b/deny.toml index 02a9cdb04a3..cb32a6f905d 100644 --- a/deny.toml +++ b/deny.toml @@ -52,7 +52,7 @@ skip = [ { name = "libloading" }, # wgpu-hal itself depends on 0.8 while some of its dependencies, like ash and d3d12, depend on 0.7 { name = "memoffset" }, # tiny dependency { name = "quick-xml" }, # old version via wayland-scanner - { name = "redox_syscall" }, # old version via directories-next + { name = "redox_syscall" }, # old version via winit { name = "spin" }, # old version via ring through rusttls and other libraries, newer for wgpu. { name = "time" }, # old version pulled in by unmaintianed crate 'chrono' { name = "windows" }, # old version via accesskit_windows