Check for file existence before attempting to open it (#626)

* Check for file existence before attempting to open it

* Fixup
This commit is contained in:
Ana Hobden 2023-09-13 09:55:44 -07:00 committed by GitHub
parent dd36129aa2
commit b3dcf07f58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 4 deletions

View file

@ -266,6 +266,10 @@ impl Action for CreateFile {
buf: _,
force: _,
} = self;
// The user already deleted it
if !path.exists() {
return Ok(());
}
remove_file(&path)
.await

View file

@ -339,6 +339,11 @@ impl Action for CreateOrInsertIntoFile {
buf,
position: _,
} = self;
// The user already deleted it
if !path.exists() {
return Ok(());
}
let mut file = OpenOptions::new()
.create(false)
.write(true)

View file

@ -104,8 +104,8 @@ impl Planner for Linux {
let Self { settings, init } = self;
let mut map = HashMap::default();
map.extend(settings.settings()?.into_iter());
map.extend(init.settings()?.into_iter());
map.extend(settings.settings()?);
map.extend(init.settings()?);
Ok(map)
}

View file

@ -234,7 +234,7 @@ impl Planner for Ostree {
} = self;
let mut map = HashMap::default();
map.extend(settings.settings()?.into_iter());
map.extend(settings.settings()?);
map.insert(
"persistence".to_string(),
serde_json::to_value(persistence)?,

View file

@ -360,7 +360,7 @@ impl Planner for SteamDeck {
} = self;
let mut map = HashMap::default();
map.extend(settings.settings()?.into_iter());
map.extend(settings.settings()?);
map.insert(
"persistence".to_string(),
serde_json::to_value(persistence)?,