diff --git a/client/scripts/scripted/exec/param-resolver.js b/client/scripts/scripted/exec/param-resolver.js index a7c55ddc..1f0dfe34 100644 --- a/client/scripts/scripted/exec/param-resolver.js +++ b/client/scripts/scripted/exec/param-resolver.js @@ -83,6 +83,25 @@ function forEditor(editor) { return editor.getFilePath(); }); + // Returns 'hello.js' from '/path/project/sub/helloworld.js' + def("${fileName}", function() { + var p = editor.getFilePath(); + return p.substring(p.lastIndexOf('/')+1); + }); + + // Returns 'sub/hello.js' from '/path/project/sub/helloworld.js' + def("${filePath}", function() { + var p = editor.getFilePath(); + return p.substring((window.fsroot || getDir()).length+1); + }); + + // Returns 'hello' from '/path/project/sub/helloworld.js' + def("${fileBase}", function() { + var p = editor.getFilePath(); + p = p.substring(p.lastIndexOf('/')+1); + return p.substring(0, p.lastIndexOf('.')); + }); + def("${dir}", getDir); def("${projectDir}", function () {