Skip to content

Commit

Permalink
Replace directories-next dependency with directories (emilk#4661)
Browse files Browse the repository at this point in the history
`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`.
  • Loading branch information
crumblingstatue authored and hacknus committed Oct 30, 2024
1 parent d5d5a00 commit 0d647b5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
26 changes: 16 additions & 10 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down Expand Up @@ -1175,7 +1175,7 @@ version = "0.27.2"
dependencies = [
"ahash",
"bytemuck",
"directories-next",
"directories",
"document-features",
"egui",
"egui-wgpu",
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ glow = [

## Enable saving app state to disk.
persistence = [
"directories-next",
"directories",
"egui-winit/serde",
"egui/persistence",
"ron",
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/src/epi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::path::PathBuf>,
}

Expand Down
4 changes: 2 additions & 2 deletions crates/eframe/src/native/file_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PathBuf> {
directories_next::ProjectDirs::from("", "", app_id)
directories::ProjectDirs::from("", "", app_id)
.map(|proj_dirs| proj_dirs.data_dir().to_path_buf())
}

Expand Down
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d647b5

Please sign in to comment.