mod config;
pub use config::{
OpenMWConfiguration, directorysetting::DirectorySetting, encodingsetting::EncodingSetting,
error::ConfigError, filesetting::FileSetting, gamesetting::GameSettingType,
genericsetting::GenericSetting,
};
pub(crate) trait GameSetting: std::fmt::Display {
fn meta(&self) -> &GameSettingMeta;
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct GameSettingMeta {
source_config: std::path::PathBuf,
comment: String,
}
const NO_CONFIG_DIR: &str = "FAILURE: COULD NOT READ CONFIG DIRECTORY";
pub fn default_config_path() -> std::path::PathBuf {
#[cfg(target_os = "android")]
return std::path::PathBuf::from("/storage/emulated/0/Alpha3/config");
#[cfg(not(target_os = "android"))]
if cfg!(windows) {
dirs::document_dir()
.expect(NO_CONFIG_DIR)
.join("My Games")
.join("openmw")
} else {
dirs::preference_dir().expect(NO_CONFIG_DIR).join("openmw")
}
}
pub fn default_userdata_path() -> std::path::PathBuf {
#[cfg(target_os = "android")]
return std::path::PathBuf::from("/storage/emulated/0/Alpha3");
#[cfg(not(target_os = "android"))]
if cfg!(windows) {
default_config_path()
} else {
dirs::data_dir()
.expect("FAILURE: COULD NOT READ USERDATA DIRECTORY")
.join("openmw")
}
}
pub fn default_data_local_path() -> std::path::PathBuf {
default_userdata_path().join("data")
}