Skip to content

Commit 0fdb05b

Browse files
Rename config file env var name
Update to ferinth 2.3 Update readme Fix find dupe function bug Switched to FO for modpack tests
1 parent 62b2210 commit 0fdb05b

File tree

8 files changed

+103
-47
lines changed

8 files changed

+103
-47
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog for Ferium
22

3+
## `v4.1.4`
4+
### 12.06.2022
5+
6+
- Fixed bug where if the slice is shorter than 2, the find dupe functions will panic
7+
- Added an env var to set the config file
8+
- Updated ferinth to `2.3.0`
9+
310
## `v4.1.3`
411
### 11.06.2022
512

Cargo.lock

Lines changed: 59 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ferium"
3-
version = "4.1.3"
3+
version = "4.1.4"
44
edition = "2021"
55
authors = [
66
"Ilesh Thiada (theRookieCoder) <[email protected]>",
@@ -41,7 +41,7 @@ itertools = "~0.10.3"
4141
fs_extra = "~1.2.0"
4242
anyhow = "~1.0.57"
4343
colored = "~2.0.0"
44-
ferinth = "~2.2.2"
44+
ferinth = "~2.3.0"
4545
libium = "~1.18.1"
4646
online = "~3.0.1"
4747
semver = "~1.0.9"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Remember to use an add-on like [cargo-update](https://crates.io/crates/cargo-upd
6868
> Note! A lot of Ferium's backend is in a seperate project [Libium](https://github.com/theRookieCoder/libium).
6969
> It deals with things such as the config, adding mod(pack)s, upgrading, file pickers, etc
7070
71-
> The config file is located at `~/.config/ferium/config.json` if you're interested in manually editing it
71+
Ferium stores profile and modpack information in it's config file. By default it is located at `~/.config/ferium/config.json`, but you can change this in 2 ways. You can set the `FERIUM_CONFIG_FILE` environment variable or set the `--config-file` global command flag, the flag always takes precedence.
7272

7373
### First Startup
7474

src/download.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ where
173173
F: Fn(&T) -> V,
174174
{
175175
let mut indices = Vec::new();
176+
if slice.len() < 2 {
177+
return indices;
178+
}
176179
slice.sort_unstable_by_key(&key);
177180
for i in 0..(slice.len() - 1) {
178181
if key(&slice[i]) == key(&slice[i + 1]) {

src/main.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,20 @@ async fn actual_main(cli_app: Ferium) -> Result<()> {
6363
})
6464
.build()?,
6565
);
66-
let modrinth = Arc::new(Ferinth::new());
66+
let modrinth = Arc::new(Ferinth::default());
6767
// Yes this is a personal API key, but I am allowed to write it in source.
6868
// The reason is the API key is used for tracking usage, it's not for authentication.
6969
// So please don't use this outside of Ferium, although telling you not to is all I can do...
7070
let curseforge = Arc::new(Furse::new(
7171
"$2a$10$QbCxI6f4KxEs50QKwE2piu1t6oOA8ayOw27H9N/eaH3Sdp5NTWwvO",
7272
));
73-
let mut config_file =
74-
config::get_file(cli_app.config_file
75-
.or_else(|| std::env::var_os("FERIUM_CONFIG_LOCATION")
76-
.map(Into::into))
77-
.unwrap_or_else(config::file_path)).await?;
73+
let mut config_file = config::get_file(
74+
cli_app
75+
.config_file
76+
.or_else(|| std::env::var_os("FERIUM_CONFIG_FILE").map(Into::into))
77+
.unwrap_or_else(config::file_path),
78+
)
79+
.await?;
7880
let mut config = config::deserialise(&config::read_file(&mut config_file).await?)?;
7981

8082
// Run function(s) based on the sub(sub)command to be executed

tests/configs/two_modpacks_cfactive.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
}
1313
},
1414
{
15-
"name": "Better Minecraft",
15+
"name": "Fabulously Optimised",
1616
"output_dir": "./tests/md_modpack",
1717
"install_overrides": true,
1818
"identifier": {
19-
"ModrinthModpack": "shFhR8Vx"
19+
"ModrinthModpack": "1KVo5zza"
2020
}
2121
}
2222
]
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
2-
"active_profile": 0,
3-
"active_modpack": 1,
4-
"profiles": [],
5-
"modpacks": [
6-
{
7-
"name": "RLCraft",
8-
"output_dir": "./tests/cf_modpack",
9-
"install_overrides": true,
10-
"identifier": {
11-
"CurseForgeModpack": 285109
12-
}
13-
},
14-
{
15-
"name": "Better Minecraft",
16-
"output_dir": "./tests/md_modpack",
17-
"install_overrides": true,
18-
"identifier": {
19-
"ModrinthModpack": "shFhR8Vx"
20-
}
21-
}
22-
]
2+
"active_profile": 0,
3+
"active_modpack": 1,
4+
"profiles": [],
5+
"modpacks": [
6+
{
7+
"name": "RLCraft",
8+
"output_dir": "./tests/cf_modpack",
9+
"install_overrides": true,
10+
"identifier": {
11+
"CurseForgeModpack": 285109
12+
}
13+
},
14+
{
15+
"name": "Fabulously Optimised",
16+
"output_dir": "./tests/md_modpack",
17+
"install_overrides": true,
18+
"identifier": {
19+
"ModrinthModpack": "1KVo5zza"
20+
}
21+
}
22+
]
2323
}

0 commit comments

Comments
 (0)