diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 0a081733..91bd7b25 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -27,7 +27,7 @@ use tokio::{ sync::mpsc::{self, Receiver, Sender}, task::JoinHandle, }; -use tracing::{debug, info, trace}; +use tracing::{debug, trace}; use crate::mod_lints::{LintId, LintReport, SplitAssetPair}; use crate::Dirs; @@ -146,8 +146,6 @@ impl App { fn new(cc: &eframe::CreationContext, dirs: Dirs, args: Option>) -> Result { let (tx, rx) = mpsc::channel(10); let state = State::init(dirs)?; - info!("config dir = {}", state.dirs.config_dir.display()); - info!("cache dir = {}", state.dirs.cache_dir.display()); Ok(Self { default_visuals: cc @@ -944,6 +942,13 @@ impl App { } ui.end_row(); + let data_dir = &self.state.dirs.data_dir; + ui.label("Data directory:"); + if ui.link(data_dir.display().to_string()).clicked() { + opener::open(data_dir).ok(); + } + ui.end_row(); + ui.label("GUI theme:"); ui.horizontal(|ui| { ui.horizontal(|ui| { diff --git a/src/lib.rs b/src/lib.rs index 32a39c24..39821c30 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,6 +23,7 @@ use providers::{ModResolution, ModSpecification, ProviderFactory, ReadSeek}; use state::State; use tracing::{info, warn}; +#[derive(Debug)] pub struct Dirs { pub config_dir: PathBuf, pub cache_dir: PathBuf, @@ -30,14 +31,23 @@ pub struct Dirs { } impl Dirs { - pub fn defauld_xdg() -> Result { + pub fn default_xdg() -> Result { + let legacy_dirs = ProjectDirs::from("", "", "drg-mod-integration") + .context("constructing project dirs")?; + let project_dirs = ProjectDirs::from("", "", "mint").context("constructing project dirs")?; Self::from_paths( - project_dirs.config_dir(), - project_dirs.cache_dir(), - project_dirs.data_dir(), + Some(legacy_dirs.config_dir()) + .filter(|p| p.exists()) + .unwrap_or(project_dirs.config_dir()), + Some(legacy_dirs.cache_dir()) + .filter(|p| p.exists()) + .unwrap_or(project_dirs.cache_dir()), + Some(legacy_dirs.data_dir()) + .filter(|p| p.exists()) + .unwrap_or(project_dirs.data_dir()), ) } pub fn from_path>(path: P) -> Result { diff --git a/src/main.rs b/src/main.rs index f799d92a..d92284f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -111,12 +111,16 @@ fn main() -> Result<()> { .appdata .as_ref() .map(Dirs::from_path) - .unwrap_or_else(Dirs::defauld_xdg)?; + .unwrap_or_else(Dirs::default_xdg)?; std::env::set_var("RUST_BACKTRACE", "1"); let _guard = setup_logging(&dirs)?; debug!("logging setup complete"); + info!("config dir = {}", dirs.config_dir.display()); + info!("cache dir = {}", dirs.cache_dir.display()); + info!("data dir = {}", dirs.data_dir.display()); + let rt = tokio::runtime::Runtime::new().expect("Unable to create Runtime"); debug!("tokio runtime created"); let _enter = rt.enter();