From 126268d8e3fd7a01d2c1041a53b968731323f0bc Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Wed, 14 Aug 2024 20:58:12 -0400 Subject: [PATCH] tweak!: move dataset file out of config dir Move the SQLite file from `XDG_CONFIG_HOME` to `XDG_DATA_HOME`, which seems like a better location for it. --- src/main.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5f9aaea..06004f7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,9 +45,7 @@ AUTH_TOKEN, or in a text file '/auth.txt'." value_name = "DIR", global = true, help = "Config directory", - long_help = "This flag overrides the default config directory. -If this directory does not exist, it will be created and a database file will -be initialized within it." + long_help = "This flag overrides the default config directory." )] config_dir: Option, } @@ -115,9 +113,14 @@ fn main() { .config_dir .map(|mut s| { s.push("startrnr"); s }) .unwrap_or_else(|| dirs::config_dir().expect("Could not determine config directory")); - let connection = - open_datasets(&config_dir).unwrap_or_else(|_| error("Could not open datasets file", 2)); + let mut data_dir = dirs::data_dir().expect("Could not determine user data directory"); + data_dir.push("startrnr"); + + let connection = + open_datasets(&data_dir).unwrap_or_else(|_| error("Could not open datasets file", 2)); + + #[allow(unreachable_patterns)] match cli.subcommand { Subcommands::Dataset { subcommand: DatasetSC::List,