diff --git a/.gitignore b/.gitignore index 54f181f..eddf1a3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ **/.idea/ **/.rrm/ + +.DS_Store diff --git a/Cargo.toml b/Cargo.toml index 3ccd40e..5991542 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ fs_extra = "1.2.0" regex = "1.5.6" rrm_locals = {path="rrm_locals", version="0.0.1-alpha.9"} -rrm_scrap = {path="rrm_scrap", version="0.0.1-alpha.7"} +rrm_scrap = {path="rrm_scrap", version="0.0.1-alpha.8"} rrm_installer = { path="rrm_installer", version="0.0.1-alpha.8"} colored = "2.0.0" text_io = "0.1.10" diff --git a/README.md b/README.md index d7f6617..b9fdab4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ -
- - -
- +
@@ -33,11 +29,7 @@ This program is installable with `cargo`. Install `rust` along with `cargo` [her ### Install To install the `crates.io` pre-release version run: - cargo install rrm --version 0.0.1-alpha.9 - -Or install the GitHub version. Although it's not recommended since it has a 'dev' flag which changes the installer behaviour: - - cargo install --git https://github.com/AOx0/rrm + cargo install rrm --version 0.0.1-alpha.10 ### Linux additional steps Additionally, if you are using **_linux_** on a 64 bit machine, you will need to add multiverse with: @@ -51,7 +43,15 @@ Additionally, if you are using **_linux_** on a 64 bit machine, you will need to

## Configuration -To set configuration values like game installation path and whether `rrm` should use `more` to display its output or not, you can use the `set` subcommand. The configuration file is available in `$USER_HOME/.rrm/config` on macOS, Linux, and Windows with a JSON format. +To set configuration values like game installation path and whether `rrm` should use `more` to display its output or not, you can use the `set` subcommand. + +The configuration file is available in, by order: + +1. `$XDG_CONFIG_HOME/rrm/config` +2. `$RRM_CONFIG_HOME/rrm/config` +3. `$CONFIG_HOME/rrm/config` +4. `$USER_HOME/.config/rrm/config` +5. `$USER_HOME/.rrm/config` For example, to set the path were RimWorld is installed, you can use: diff --git a/rrm_installer/src/lib.rs b/rrm_installer/src/lib.rs index d8eaf8b..69064c0 100644 --- a/rrm_installer/src/lib.rs +++ b/rrm_installer/src/lib.rs @@ -44,11 +44,7 @@ pub fn get_or_create_config_dir() -> PathBuf { return path; } - if let Some(path) = env_var_config("RRM_CONFIG_DIR") { - return path; - } - - if let Some(path) = env_var_config("CONFIG_DIR") { + if let Some(path) = env_var_config("RRM_CONFIG_HOME") { return path; } @@ -66,13 +62,6 @@ pub fn get_or_create_config_dir() -> PathBuf { } let config_dir = UserDirs::new().unwrap().home_dir().join(".rrm"); - if !config_dir.exists() { - fs::create_dir_all(&config_dir).unwrap(); - return config_dir.to_path_buf(); - } - - let binding = ProjectDirs::from("com", "AOx0", "rrm").unwrap(); - let config_dir = binding.preference_dir(); if !config_dir.exists() { fs::create_dir_all(&config_dir).unwrap(); } @@ -83,6 +72,7 @@ pub fn get_or_create_config_dir() -> PathBuf { fn env_var_config(var: &'static str) -> Option { let env_config_dir = std::env::var(var); if let Ok(env_config_dir) = env_config_dir { + let env_config_dir = PathBuf::from(env_config_dir).join("rrm"); if !Path::new(&env_config_dir).exists() { fs::create_dir_all(&env_config_dir).unwrap(); } diff --git a/rrm_scrap/Cargo.toml b/rrm_scrap/Cargo.toml index 6b4a39b..387d4ee 100644 --- a/rrm_scrap/Cargo.toml +++ b/rrm_scrap/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rrm_scrap" -version = "0.0.1-alpha.7" +version = "0.0.1-alpha.8" edition = "2021" authors = ["AOx0 "] description = "Part of rrm" @@ -19,4 +19,4 @@ lazy-regex = "2.3.0" fuzzy-matcher = "0.3.7" html-escape = "0.2.11" flagset = "0.4.3" -rrm_locals = {path="../rrm_locals", version="0.0.1-alpha.7"} +rrm_locals = {path="../rrm_locals", version="0.0.1-alpha.9"} diff --git a/src/async_installer.rs b/src/async_installer.rs index 2c08212..4a00448 100644 --- a/src/async_installer.rs +++ b/src/async_installer.rs @@ -90,6 +90,11 @@ pub async fn install( while let Some(line) = reader.next_line().await.unwrap() { if line.contains("Waiting for client config...OK") { + + if !&get_or_create_config_dir().join(path_downloads.parent().unwrap()).exists() { + std::fs::create_dir_all(&get_or_create_config_dir().join(path_downloads.parent().unwrap())).unwrap(); + } + start_file_watcher .watch( &get_or_create_config_dir().join(path_downloads.parent().unwrap()),