Skip to content

Commit

Permalink
Fixed: file returned from config::get_file() not readable if newly …
Browse files Browse the repository at this point in the history
…created
  • Loading branch information
theRookieCoder committed Nov 13, 2022
1 parent c681c51 commit c8414cc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog for Libium

## `1.21.1`
### 13.11.2022

Fixed a bug where the file returned from `config::get_file()` is not readable if it's newly created

## `1.21.0`
### 13.11.2022

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libium"
version = "1.21.0"
version = "1.21.1"
edition = "2021"
authors = [
"Ilesh Thiada (theRookieCoder) <ileshkt@gmail.com>",
Expand Down
8 changes: 7 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ pub async fn get_file(config_file_path: PathBuf) -> Result<File> {
if !config_file_path.exists() {
// Create the config file directory
create_dir_all(config_file_path.parent().unwrap()).await?;
let mut file = File::create(config_file_path).await?;
let mut file = OpenOptions::new()
.read(true)
.write(true)
.truncate(false)
.create(true)
.open(config_file_path)
.await?;
write_file(
&mut file,
&Config {
Expand Down

0 comments on commit c8414cc

Please sign in to comment.