Skip to content

Commit 6248004

Browse files
Fix #181, and check that there are modpacks before listing them
1 parent 6ae2539 commit 6248004

File tree

5 files changed

+56
-49
lines changed

5 files changed

+56
-49
lines changed

CHANGELOG.md

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

3+
## `4.1.9`
4+
### 25.07.2022
5+
6+
- Fix [#181](https://github.com/gorilla-devs/ferium/issues/181), create the backup directory before copying files over
7+
- Check that there are modpacks before listing them
8+
39
## `v4.1.8`
410
### 18.07.2022
511

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ferium"
3-
version = "4.1.8"
3+
version = "4.1.9"
44
edition = "2021"
55
# Because of `std::process::ExitCode`
66
rust-version = "1.61"
@@ -23,7 +23,7 @@ gtk = ["libium/gtk"]
2323
xdg = ["libium/xdg"]
2424

2525
[dependencies]
26-
tokio = { version = "~1.20.0", default-features = false, features = [
26+
tokio = { version = "~1.20.1", default-features = false, features = [
2727
"rt-multi-thread",
2828
"macros",
2929
] }
@@ -33,7 +33,7 @@ reqwest = { version = "~0.11.11", default-features = false, features = [
3333
octocrab = { version = "~0.16.0", default-features = false, features = [
3434
"rustls",
3535
] }
36-
clap = { version = "~3.2.12", features = ["derive"] }
36+
clap = { version = "~3.2.14", features = ["derive"] }
3737
clap_complete = "~3.2.3"
3838
lazy_static = "~1.4.0"
3939
serde_json = "~1.0.82"

src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,12 @@ async fn actual_main(cli_app: Ferium) -> Result<()> {
259259
ModpackSubCommands::Delete { modpack_name } => {
260260
subcommands::modpack::delete(&mut config, modpack_name)?;
261261
},
262-
ModpackSubCommands::List => subcommands::modpack::list(&config),
262+
ModpackSubCommands::List => {
263+
if config.modpacks.is_empty() {
264+
bail!("There are no modpacks configured, add a modpack using `ferium modpack add`")
265+
}
266+
subcommands::modpack::list(&config);
267+
},
263268
ModpackSubCommands::Switch { modpack_name } => {
264269
subcommands::modpack::switch(&mut config, modpack_name)?;
265270
},

src/subcommands/profile/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use libium::{
2121
HOME,
2222
};
2323
use std::{fs::read_dir, path::PathBuf};
24+
use tokio::fs::create_dir_all;
2425

2526
pub fn pick_mod_loader(default: Option<&ModLoader>) -> Result<ModLoader> {
2627
let mut picker = Select::with_theme(&*THEME);
@@ -90,6 +91,7 @@ pub async fn check_output_directory(output_dir: &PathBuf) -> Result<()> {
9091
let backup_dir = pick_folder(&*HOME, "Where should the backup be made?")
9192
.await
9293
.unwrap();
94+
create_dir_all(&backup_dir).await?;
9395
copy(output_dir, backup_dir, &CopyOptions::new())?;
9496
}
9597
}

0 commit comments

Comments
 (0)