You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.
Below function pruneMatchLogsIfNecessary, even though the author is wanting to delete the old logs the code actually deletes the latest logs. You can test this by creating 5 or more logs and see that after 5 logs are created it always deleted the latest log instead of the old one. I could not find the repo of FTC SDK, if you could point me to the original FTC SDK repo i can send you in the required change.
/*
pruneMatchLogsIfNecessary
Some reasonable upper bound on number of files to keep around. Remove via first in, first out.
*/
protected static void pruneMatchLogsIfNecessary() {
File directory = AppUtil.MATCH_LOG_FOLDER;
File[] files = directory.listFiles();
if (files.length >= AppUtil.MAX_MATCH_LOGS_TO_KEEP) {
Arrays.sort(files, new Comparator<File>() {
public int compare(File f1, File f2) {
/*
* Reverse sorting on purpose.
*/
return Long.compare(f2.lastModified(), f1.lastModified());
}
});
/*
* There should never be more than one extra log, but just to be paranoid...
*/
for (int i = 0; i < files.length - AppUtil.MAX_MATCH_LOGS_TO_KEEP; i++) {
RobotLog.ii(TAG, "Pruning old logs deleting " + files[i].getName());
files[i].delete();
}
}
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Below function pruneMatchLogsIfNecessary, even though the author is wanting to delete the old logs the code actually deletes the latest logs. You can test this by creating 5 or more logs and see that after 5 logs are created it always deleted the latest log instead of the old one. I could not find the repo of FTC SDK, if you could point me to the original FTC SDK repo i can send you in the required change.
/*
*/
protected static void pruneMatchLogsIfNecessary() {
File directory = AppUtil.MATCH_LOG_FOLDER;
File[] files = directory.listFiles();
}
The text was updated successfully, but these errors were encountered: