Skip to content

Commit

Permalink
Fix env var. & bump versions
Browse files Browse the repository at this point in the history
  • Loading branch information
AOx0 committed Oct 16, 2022
1 parent 05bc0ef commit 8db8230
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
**/.idea/

**/.rrm/

.DS_Store
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<div>
<img src="https://img.shields.io/badge/GitHub Version-0.0.1--alpha.9-green">
</img><img src="https://img.shields.io/badge/Status-Almost Done-yellow">
</div>
<div>
<a href="https://crates.io/crates/rrm">
<img src="https://img.shields.io/badge/crates.io%20Version-0.0.1--alpha.9-green"></img>
<img src="https://img.shields.io/badge/Version-0.0.1--alpha.10-green"></img>
</a>
<img src="https://img.shields.io/badge/Status-Almost Done-yellow">
</div>
Expand Down Expand Up @@ -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:
Expand All @@ -51,7 +43,15 @@ Additionally, if you are using **_linux_** on a 64 bit machine, you will need to

<br/> <br/>
## 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:

Expand Down
14 changes: 2 additions & 12 deletions rrm_installer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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();
}
Expand All @@ -83,6 +72,7 @@ pub fn get_or_create_config_dir() -> PathBuf {
fn env_var_config(var: &'static str) -> Option<PathBuf> {
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();
}
Expand Down
4 changes: 2 additions & 2 deletions rrm_scrap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rrm_scrap"
version = "0.0.1-alpha.7"
version = "0.0.1-alpha.8"
edition = "2021"
authors = ["AOx0 <[email protected]>"]
description = "Part of rrm"
Expand All @@ -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"}
5 changes: 5 additions & 0 deletions src/async_installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ pub async fn install<T: InstallingOptions>(

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()),
Expand Down

0 comments on commit 8db8230

Please sign in to comment.