From 4fb02fe18729d463c80de19d2ab60593a016873e Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 27 Aug 2012 11:21:11 +0000 Subject: [PATCH] * force proper return value for custom closure --- source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy index 6bc07fb0..c7a19867 100644 --- a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy +++ b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy @@ -308,7 +308,7 @@ def _renameFunction(fn) { if (fn instanceof String) return StandardRenameAction.forName(fn) if (fn instanceof Closure) - return [rename:fn as Closure, toString:{'CLOSURE'}] as RenameAction + return [rename:{ from, to -> def result = fn.call(from, to); result instanceof File ? result : to }, toString:{'CLOSURE'}] as RenameAction return fn as RenameAction }