MCPcopy Index your code
hub / github.com/benfry/processing4 / cleanTempFolders

Method cleanTempFolders

app/src/processing/app/Base.java:412–437  ·  view source on GitHub ↗

Clean folders and files from the Processing subdirectory of the user's temp folder (java.io.tmpdir).

()

Source from the content-addressed store, hash-verified

410 * of the user's temp folder (java.io.tmpdir).
411 */
412 static public void cleanTempFolders() {
413 try {
414 final File tempDir = Util.getProcessingTemp();
415 final int days = Preferences.getInteger("temp.days");
416
417 if (days > 0) {
418 final long now = new Date().getTime();
419 final long diff = days * 24 * 60 * 60 * 1000L;
420 File[] expiredFiles =
421 tempDir.listFiles(file -> (now - file.lastModified()) > diff);
422 if (expiredFiles != null) {
423 // Remove the files approved for deletion
424 for (File file : expiredFiles) {
425 try {
426 // move to trash or delete if unavailable
427 Platform.deleteFile(file);
428 } catch (IOException e) {
429 e.printStackTrace();
430 }
431 }
432 }
433 }
434 } catch (IOException e) {
435 e.printStackTrace();
436 }
437 }
438
439
440 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Callers 1

handleTempCleaningMethod · 0.95

Calls 6

getProcessingTempMethod · 0.95
getIntegerMethod · 0.95
deleteFileMethod · 0.95
getTimeMethod · 0.80
listFilesMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected