Desktop: fix bug when not creating config dir

This commit is contained in:
Igor Katson 2023-12-07 16:18:18 +00:00
parent 2fdea72702
commit a5e7a5a5f5
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
2 changed files with 7 additions and 4 deletions

View file

@ -1867,7 +1867,7 @@ dependencies = [
[[package]]
name = "librqbit"
version = "5.0.0-beta.1"
version = "5.0.0"
dependencies = [
"anyhow",
"axum",
@ -1933,7 +1933,7 @@ version = "2.2.1"
[[package]]
name = "librqbit-core"
version = "3.3.0"
version = "3.4.0"
dependencies = [
"anyhow",
"directories",
@ -1953,7 +1953,7 @@ dependencies = [
[[package]]
name = "librqbit-dht"
version = "5.0.0-beta.1"
version = "5.0.0"
dependencies = [
"anyhow",
"backoff",
@ -1978,7 +1978,7 @@ dependencies = [
[[package]]
name = "librqbit-peer-protocol"
version = "3.3.0"
version = "3.4.0"
dependencies = [
"anyhow",
"bincode",

View file

@ -6,6 +6,7 @@ mod config;
use std::{
fs::{File, OpenOptions},
io::{BufReader, BufWriter},
path::Path,
sync::Arc,
};
@ -49,6 +50,8 @@ fn read_config(path: &str) -> anyhow::Result<RqbitDesktopConfig> {
}
fn write_config(path: &str, config: &RqbitDesktopConfig) -> anyhow::Result<()> {
std::fs::create_dir_all(Path::new(path).parent().context("no parent")?)
.context("error creating dirs")?;
let tmp = format!("{}.tmp", path);
let mut tmp_file = BufWriter::new(
OpenOptions::new()