mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-29 04:23:29 +01: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;
|
app = getCorrectedInstallStatusAppIfPossible(app, info) ?? app;
|
||||||
}
|
}
|
||||||
if (!onlyIfExists || this.apps.containsKey(app.id)) {
|
if (!onlyIfExists || this.apps.containsKey(app.id)) {
|
||||||
File('${(await getAppsDir()).path}/${app.id}.json')
|
String filePath = '${(await getAppsDir()).path}/${app.id}.json';
|
||||||
.writeAsStringSync(jsonEncode(app.toJson()));
|
File('$filePath.tmp')
|
||||||
|
.writeAsStringSync(jsonEncode(app.toJson())); // #2089
|
||||||
|
File('$filePath.tmp').renameSync(filePath);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.apps.update(app.id,
|
this.apps.update(app.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user