mirror of
https://github.com/badvision/jace.git
synced 2025-01-16 00:31:22 +00:00
Dispose of temporary files when doing test compilation
This commit is contained in:
parent
0abc87675b
commit
df6101ddc5
@ -65,5 +65,8 @@ public class ApplesoftHandler implements LanguageHandler<ApplesoftProgram> {
|
||||
public void execute(CompileResult<ApplesoftProgram> lastResult) {
|
||||
lastResult.getCompiledAsset().run();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clean(CompileResult<ApplesoftProgram> lastResult) {
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,11 @@ public class AssemblyHandler implements LanguageHandler<File> {
|
||||
Logger.getLogger(AssemblyHandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
clean(lastResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clean(CompileResult<File> lastResult) {
|
||||
lastResult.getCompiledAsset().delete();
|
||||
}
|
||||
}
|
||||
|
@ -219,12 +219,15 @@ public class Program {
|
||||
manageCompileResult(lastResult);
|
||||
if (lastResult.isSuccessful()) {
|
||||
getHandler().execute(lastResult);
|
||||
} else {
|
||||
getHandler().clean(lastResult);
|
||||
}
|
||||
}
|
||||
|
||||
public void test() {
|
||||
lastResult = getHandler().compile(this);
|
||||
manageCompileResult(lastResult);
|
||||
getHandler().clean(lastResult);
|
||||
}
|
||||
|
||||
private void manageCompileResult(CompileResult lastResult) {
|
||||
|
@ -9,7 +9,7 @@ import java.util.Map;
|
||||
*
|
||||
* @author blurry
|
||||
*/
|
||||
class TextHandler implements LanguageHandler<String> {
|
||||
public class TextHandler implements LanguageHandler<String> {
|
||||
public TextHandler() {
|
||||
}
|
||||
|
||||
@ -57,4 +57,8 @@ class TextHandler implements LanguageHandler<String> {
|
||||
public void execute(CompileResult<String> lastResult) {
|
||||
Keyboard.pasteFromString(lastResult.getCompiledAsset());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clean(CompileResult<String> lastResult) {
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user