Merge pull request #43 from SmilerRyan:beta

Add portable configuration option.
This commit is contained in:
Dmitriy
2024-11-16 18:57:01 +03:00
committed by GitHub
2 changed files with 21 additions and 3 deletions

View File

@@ -23,8 +23,13 @@ impl DirectoryInfo {
// Get the settings directory
// init() is not needed for this function
pub fn get_initial_settings_dir() -> Option<PathBuf> {
Self::env_path("THESEUS_CONFIG_DIR")
.or_else(|| Some(dirs::data_dir()?.join("AstralRinthApp")))
Self::env_path("THESEUS_CONFIG_DIR").or_else(|| {
if std::env::current_dir().ok()?.join("portable.txt").exists() {
Some(std::path::Path::new("UserData").to_path_buf())
} else {
Some(dirs::data_dir()?.join("AstralRinthApp"))
}
})
}
/// Get all paths needed for Theseus to operate properly