Fix crash on read-only mimeapps.list

Write permissions are not necessary when reading the file
This commit is contained in:
Michael Adler 2021-07-16 09:42:17 +02:00
parent 944b8cd8c1
commit a782886f05

View file

@ -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)?;