mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-10 04:24:05 +08:00
Added: Allow users to adjust $TMPDIR
clear mechanism on termux exit
The `delete-tmpdir-files-older-than-x-days-on-exit` key can be used to adjust how many days old the access time should be of files that should be deleted from `$TMPDIR` on termux exit. The user can set an integer value between `-1` and `100000`. Set `-1` to delete no files, `0` to delete all files and `> 0` for `x` days. The default value is `3` days. So adding an entry like `delete-tmpdir-files-older-than-x-days-on-exit=10` to `termux.properties` file will make termux delete files older than `10` when termux is exited. After updating the value, either restart termux or run `termux-reload-settings` for changes to take effect. Note that currently `> 0` will revert back to `0` since deletion is currently broken for empty sub directories and deletion needs to be done based on access time instead of modified time. It will need to be fixed in a later commit. Check `FileUtils.deleteFilesOlderThanXDays()`. Related issue #2350
This commit is contained in:
@@ -1352,6 +1352,10 @@ public class FileUtils {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Use FileAttributes with support for atime (default), mtime, ctime. Add regex for ignoring file and dir absolute paths.
|
||||
// FIXME: iterateFiles() does not return subdirectories even with TrueFileFilter for file and dir.
|
||||
// FIXME: Empty directories remain
|
||||
|
||||
// If directory exists, delete its contents
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -(days));
|
||||
|
Reference in New Issue
Block a user