mirror of
https://github.com/chmln/handlr.git
synced 2024-11-14 21:49:27 +01:00
Merge pull request #48 from michaeladler/feature/fix-read-only-crash
Fix crash on read-only mimeapps
This commit is contained in:
commit
b9b71369f8
1 changed files with 3 additions and 2 deletions
|
@ -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)?;
|
||||
|
|
Loading…
Reference in a new issue