1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-25 09:18:51 -05:00

* fix issue with args not being passed in

This commit is contained in:
Reinhard Pointner 2013-10-22 09:15:46 +00:00
parent 3ad6b1f55d
commit d623c07373
2 changed files with 10 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import java.awt.AWTPermission;
import java.io.File; import java.io.File;
import java.io.FilePermission; import java.io.FilePermission;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.lang.management.ManagementPermission;
import java.lang.reflect.ReflectPermission; import java.lang.reflect.ReflectPermission;
import java.net.SocketPermission; import java.net.SocketPermission;
import java.net.URI; import java.net.URI;
@ -170,10 +171,14 @@ class ScriptShell {
Permissions permissions = new Permissions(); Permissions permissions = new Permissions();
permissions.add(new RuntimePermission("createClassLoader")); permissions.add(new RuntimePermission("createClassLoader"));
permissions.add(new RuntimePermission("accessClassInPackage.*"));
permissions.add(new RuntimePermission("modifyThread"));
permissions.add(new FilePermission("<<ALL FILES>>", "read")); permissions.add(new FilePermission("<<ALL FILES>>", "read"));
permissions.add(new SocketPermission("*", "connect")); permissions.add(new SocketPermission("*", "connect"));
permissions.add(new PropertyPermission("*", "read")); permissions.add(new PropertyPermission("*", "read"));
permissions.add(new RuntimePermission("getenv.*")); permissions.add(new RuntimePermission("getenv.*"));
permissions.add(new RuntimePermission("getFileSystemAttributes"));
permissions.add(new ManagementPermission("monitor"));
// write permissions for temp and cache folders // write permissions for temp and cache folders
permissions.add(new FilePermission(new File(System.getProperty("ehcache.disk.store.dir")).getAbsolutePath() + File.separator + "-", "write, delete")); permissions.add(new FilePermission(new File(System.getProperty("ehcache.disk.store.dir")).getAbsolutePath() + File.separator + "-", "write, delete"));

View File

@ -257,11 +257,12 @@ List.metaClass.sortBySimilarity = { prime, Closure toStringFunction = { obj -> o
// call scripts // call scripts
def executeScript(String input, Map bindings = [:], Object... args) { def executeScript(String input, Map bindings = [:], Object... args) {
// apply parent script defines // apply parent script defines
def parameters = new javax.script.SimpleBindings(bindings != null ? _def : [:]) def parameters = new javax.script.SimpleBindings()
parameters.putAll(bindings)
// initialize default parameter // initialize default parameter
parameters['args'] = (args as List).flatten().findResults{ it as File } parameters.putAll(_def)
parameters.putAll(bindings)
parameters.put('args', args.toList().flatten().findResults{ it as File })
// run given script // run given script
_shell.runScript(input, parameters) _shell.runScript(input, parameters)