mirror of
https://github.com/chmln/handlr.git
synced 2024-11-27 03:13:49 +01:00
Fix crash on read-only mimeapps.list
Write permissions are not necessary when reading the file
This commit is contained in:
parent
944b8cd8c1
commit
a782886f05
1 changed files with 3 additions and 2 deletions
|
@ -113,9 +113,10 @@ impl MimeApps {
|
||||||
pub fn read() -> Result<Self> {
|
pub fn read() -> Result<Self> {
|
||||||
let raw_conf = {
|
let raw_conf = {
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
|
let exists = std::path::Path::new(&Self::path()?).exists();
|
||||||
std::fs::OpenOptions::new()
|
std::fs::OpenOptions::new()
|
||||||
.write(true)
|
.write(!exists)
|
||||||
.create(true)
|
.create(!exists)
|
||||||
.read(true)
|
.read(true)
|
||||||
.open(Self::path()?)?
|
.open(Self::path()?)?
|
||||||
.read_to_string(&mut buf)?;
|
.read_to_string(&mut buf)?;
|
||||||
|
|
Loading…
Reference in a new issue