Skip to content

Commit

Permalink
Only delete logged apk
Browse files Browse the repository at this point in the history
To avoid unintended deletion of apks only the apk logged as the old
version should be deleted. This will probably cause some backup
directories to have two apks during the first backup cycle after this
commit if the package has been updated in the meantime.
  • Loading branch information
jensstein committed Nov 5, 2014
1 parent 4c9af39 commit e228dd2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/dk/jens/backup/BackupRestoreHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ public static int backup(Context context, File backupDir, AppInfo appInfo, Shell
if(!backupSubDir.exists())
backupSubDir.mkdirs();
else if(backupMode != AppInfo.MODE_DATA && appInfo.getSourceDir().length() > 0)
shellCommands.deleteOldApk(backupSubDir, appInfo.getSourceDir());
{
if(appInfo.getLogInfo() != null && appInfo.getLogInfo().getSourceDir().length() > 0 && !appInfo.getSourceDir().equals(appInfo.getLogInfo().getSourceDir()))
{
String apk = appInfo.getLogInfo().getApk();
if(apk != null)
ShellCommands.deleteBackup(new File(backupSubDir, apk));
}
}

if(appInfo.isSpecial())
{
Expand Down

0 comments on commit e228dd2

Please sign in to comment.