mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-12 18:08:10 +02:00
Delete downloaded APK on install fail (#1495)
This commit is contained in:
@@ -297,8 +297,6 @@ Future<File> downloadFile(
|
|||||||
tempDownloadedFile.deleteSync(recursive: true);
|
tempDownloadedFile.deleteSync(recursive: true);
|
||||||
throw response.reasonPhrase ?? tr('unexpectedError');
|
throw response.reasonPhrase ?? tr('unexpectedError');
|
||||||
}
|
}
|
||||||
print(tempDownloadedFile.lengthSync());
|
|
||||||
print(fullContentLength);
|
|
||||||
if (tempDownloadedFile.existsSync()) {
|
if (tempDownloadedFile.existsSync()) {
|
||||||
tempDownloadedFile.renameSync(downloadedFile.path);
|
tempDownloadedFile.renameSync(downloadedFile.path);
|
||||||
}
|
}
|
||||||
@@ -648,7 +646,13 @@ class AppsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
bool installed = false;
|
bool installed = false;
|
||||||
if (code != null && code != 0 && code != 3) {
|
if (code != null && code != 0 && code != 3) {
|
||||||
throw InstallError(code);
|
try {
|
||||||
|
file.file.deleteSync(recursive: true);
|
||||||
|
} catch (e) {
|
||||||
|
//
|
||||||
|
} finally {
|
||||||
|
throw InstallError(code);
|
||||||
|
}
|
||||||
} else if (code == 0) {
|
} else if (code == 0) {
|
||||||
installed = true;
|
installed = true;
|
||||||
apps[file.appId]!.app.installedVersion =
|
apps[file.appId]!.app.installedVersion =
|
||||||
|
Reference in New Issue
Block a user