mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-13 05:16:43 +02:00
Avoid JSON corruption when storage full (#2089)
This commit is contained in:
@ -1454,8 +1454,10 @@ class AppsProvider with ChangeNotifier {
|
||||
app = getCorrectedInstallStatusAppIfPossible(app, info) ?? app;
|
||||
}
|
||||
if (!onlyIfExists || this.apps.containsKey(app.id)) {
|
||||
File('${(await getAppsDir()).path}/${app.id}.json')
|
||||
.writeAsStringSync(jsonEncode(app.toJson()));
|
||||
String filePath = '${(await getAppsDir()).path}/${app.id}.json';
|
||||
File('$filePath.tmp')
|
||||
.writeAsStringSync(jsonEncode(app.toJson())); // #2089
|
||||
File('$filePath.tmp').renameSync(filePath);
|
||||
}
|
||||
try {
|
||||
this.apps.update(app.id,
|
||||
|
Reference in New Issue
Block a user