Skip to content

Commit

Permalink
Merge pull request #48 from michaeladler/feature/fix-read-only-crash
Browse files Browse the repository at this point in the history
Fix crash on read-only mimeapps
  • Loading branch information
chmln committed Jul 30, 2021
2 parents 944b8cd + a782886 commit b9b7136
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/apps/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ impl MimeApps {
pub fn read() -> Result<Self> {
let raw_conf = {
let mut buf = String::new();
let exists = std::path::Path::new(&Self::path()?).exists();
std::fs::OpenOptions::new()
.write(true)
.create(true)
.write(!exists)
.create(!exists)
.read(true)
.open(Self::path()?)?
.read_to_string(&mut buf)?;
Expand Down

0 comments on commit b9b7136

Please sign in to comment.