mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-10-16 07:03:04 +00:00
script tests should wipe the directory after each test
This commit is contained in:
parent
4c655c2e92
commit
b569c79baf
|
@ -20,6 +20,7 @@ import static org.junit.Assert.*;
|
|||
import java.awt.Window;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -165,9 +166,21 @@ public abstract class AbstractGhidraScriptMgrPluginTest
|
|||
testScriptFile.delete();
|
||||
}
|
||||
|
||||
wipeUserScripts();
|
||||
|
||||
env.dispose();
|
||||
}
|
||||
|
||||
protected void wipeUserScripts() throws IOException {
|
||||
java.nio.file.Path userScriptDir =
|
||||
java.nio.file.Paths.get(GhidraScriptUtil.USER_SCRIPTS_DIR);
|
||||
Iterator<java.nio.file.Path> it = Files.list(userScriptDir).iterator();
|
||||
while (it.hasNext()) {
|
||||
Files.walk(it.next()).sorted(Comparator.reverseOrder()).map(
|
||||
java.nio.file.Path::toFile).forEach(File::delete);
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
// Private Methods
|
||||
//==================================================================================================
|
||||
|
|
Loading…
Reference in a new issue