MCPcopy Index your code
hub / github.com/java-native-access/jna / removeTemporaryFiles

Method removeTemporaryFiles

src/com/sun/jna/Native.java:1433–1451  ·  view source on GitHub ↗

Remove all marked temporary files in the given directory.

()

Source from the content-addressed store, hash-verified

1431
1432 /** Remove all marked temporary files in the given directory. */
1433 static void removeTemporaryFiles() throws IOException {
1434 File dir = getTempDir();
1435 FilenameFilter filter = new FilenameFilter() {
1436 @Override
1437 public boolean accept(File dir, String name) {
1438 return name.endsWith(".x") && name.startsWith(JNA_TMPLIB_PREFIX);
1439 }
1440 };
1441 File[] files = dir.listFiles(filter);
1442 for (int i=0;files != null && i < files.length;i++) {
1443 File marker = files[i];
1444 String name = marker.getName();
1445 name = name.substring(0, name.length()-2);
1446 File target = new File(marker.getParentFile(), name);
1447 if (!target.exists() || target.delete()) {
1448 marker.delete();
1449 }
1450 }
1451 }
1452
1453 /**
1454 * @param type The Java class for which the native size is to be determined

Callers 2

testRemoveTemporariesMethod · 0.95

Calls 4

getTempDirMethod · 0.95
getNameMethod · 0.65
lengthMethod · 0.45
deleteMethod · 0.45

Tested by 1

testRemoveTemporariesMethod · 0.76