Skip to content

Commit be2057d

Browse files
PJB3005jbuehler23
authored andcommitted
Use proper appdata paths on Windows/macOS
1 parent c5849dc commit be2057d

14 files changed

Lines changed: 47 additions & 42 deletions

File tree

.github/workflows/release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ jobs:
166166
-p jackdaw_camera_rig
167167
-p jackdaw_commands
168168
-p jackdaw_dylib
169+
-p jackdaw_env
169170
-p jackdaw_extension
170171
-p jackdaw_feathers
171172
-p jackdaw_fuzzy

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/jackdaw_api_internal/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jackdaw_panels.workspace = true
1313
jackdaw_commands.workspace = true
1414
jackdaw_api_macros.workspace = true
1515
jackdaw_scene_types.workspace = true
16+
jackdaw_env.workspace = true
1617
lucide-icons.workspace = true
1718
dirs.workspace = true
1819
serde.workspace = true

crates/jackdaw_api_internal/src/extensions_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{collections::BTreeMap, path::PathBuf};
77
use bevy::{platform::collections::HashSet, prelude::*};
88
use serde::{Deserialize, Serialize};
99

10-
use crate::paths::config_dir;
10+
use jackdaw_env::paths::config_dir;
1111

1212
/// On-disk shape. Maps extension IDs to their configuration.
1313
#[derive(Serialize, Deserialize, Default, Deref, DerefMut)]

crates/jackdaw_api_internal/src/keymap/persist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use bevy::prelude::*;
77
use super::types::ActiveKeymapPreset;
88

99
fn keymap_preset_path() -> Option<PathBuf> {
10-
crate::paths::config_dir().map(|d| d.join("keymap_preset.json"))
10+
jackdaw_env::paths::config_dir().map(|d| d.join("keymap_preset.json"))
1111
}
1212

1313
/// Load the active keymap preset from disk. Returns the default ("classic")

crates/jackdaw_api_internal/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub mod keymap;
3939
pub mod keymap_conditions;
4040
pub mod lifecycle;
4141
pub mod operator;
42-
pub mod paths;
4342
pub mod pie;
4443
mod registries;
4544
pub mod runtime;

crates/jackdaw_api_internal/src/paths.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

crates/jackdaw_env/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ license = "MIT OR Apache-2.0"
77
repository = "https://github.com/jbuehler23/jackdaw"
88

99
[dependencies]
10+
dirs.workspace = true
1011

1112
[lints]
1213
workspace = true

crates/jackdaw_env/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::{ffi::OsStr, process::Command};
22

3+
pub mod paths;
4+
35
pub const RUSTUP_TOOLCHAIN: &str = "nightly-2026-03-05";
46

57
pub fn rust_env_command<S: AsRef<OsStr>>(command: S) -> std::process::Command {

crates/jackdaw_env/src/paths.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
use std::path::PathBuf;
2+
3+
pub const DATA_DIR_NAME: &str = "jackdaw";
4+
pub const DATA_DIR_FALLBACK_NAME: &str = ".jackdaw";
5+
6+
pub fn data_dir() -> Option<PathBuf> {
7+
dirs::data_dir()
8+
.map(|p| p.join(DATA_DIR_NAME))
9+
.or_else(data_dir_fallback)
10+
}
11+
12+
pub fn config_dir() -> Option<PathBuf> {
13+
dirs::config_dir()
14+
.map(|d| d.join(DATA_DIR_NAME))
15+
.or_else(data_dir_fallback)
16+
}
17+
18+
pub fn recent_file_path() -> Option<PathBuf> {
19+
config_dir().map(|d| d.join("recent.json"))
20+
}
21+
22+
pub fn last_new_project_location_path() -> Option<PathBuf> {
23+
config_dir().map(|d| d.join("last_new_project_location"))
24+
}
25+
26+
pub fn keybinds_path() -> Option<std::path::PathBuf> {
27+
config_dir().map(|d| d.join("keybinds.json"))
28+
}
29+
30+
fn data_dir_fallback() -> Option<PathBuf> {
31+
std::env::home_dir().map(|p| p.join(DATA_DIR_FALLBACK_NAME))
32+
}

0 commit comments

Comments
 (0)