Remove old cache files when backup settings is changed

This commit is contained in:
Girish Ramakrishnan
2017-09-27 20:52:36 -07:00
parent eeef221b4e
commit 56ee4d8e25
2 changed files with 12 additions and 0 deletions
+10
View File
@@ -22,6 +22,7 @@ exports = module.exports = {
download: download,
cleanup: cleanup,
cleanupCacheFilesSync: cleanupCacheFilesSync,
// for testing
_getBackupFilePath: getBackupFilePath,
@@ -865,6 +866,15 @@ function cleanupBoxBackups(backupConfig, callback) {
});
}
function cleanupCacheFilesSync() {
var files = safe.fs.readdirSync(path.join(paths.BACKUP_INFO_DIR));
if (!files) return;
files.filter(function (f) { return f.endsWith('.sync.cache'); }).forEach(function (f) {
safe.fs.unlinkSync(path.join(paths.BACKUP_INFO_DIR, f));
});
}
// removes the snapshots of apps that have been uninstalled
function cleanupSnapshots(backupConfig, callback) {
assert.strictEqual(typeof backupConfig, 'object');