diff --git a/Objective-J/CommonJS/lib/objective-j.js b/Objective-J/CommonJS/lib/objective-j.js index 5b000e61a..cc2fb248c 100644 --- a/Objective-J/CommonJS/lib/objective-j.js +++ b/Objective-J/CommonJS/lib/objective-j.js @@ -112,6 +112,13 @@ exports.run = function(args) { if (args && args.length > 1) { + // we expect args to be in the format: + // 1) "objj" path + // 2) optional "-I" args + // 3) real or "virtual" main.j + // 4) optional program arguments + + // copy the args since we're going to modify them var argv = args.slice(1); while (argv.length && argv[0].indexOf('-I') === 0) diff --git a/Objective-J/CommonJS/objj-executable b/Objective-J/CommonJS/objj-executable index 36a954d58..919302c11 100755 --- a/Objective-J/CommonJS/objj-executable +++ b/Objective-J/CommonJS/objj-executable @@ -1,15 +1,7 @@ #!/usr/bin/env narwhal -var FILE = require("file"); +var execPath = require("file").path(module.path); +var mainPath = execPath.dirname().dirname().join("lib", execPath.basename(), "main.j"); -var cappuccinoPackage = FILE.path(module.path).dirname().dirname(); -var mainPath = cappuccinoPackage.join("lib", FILE.basename(module.path), "main.j"); -var frameworksPath = cappuccinoPackage.join("Frameworks"); - -// TODO: is specifying the Frameworks necessary? -system.args.splice(1, 0, "-I"+frameworksPath, String(mainPath)); - -// HACK: remove use of SELF_HOME from capp gen -system.env["SELF_HOME"] = cappuccinoPackage; - -require("objective-j").run(system.args); +var args = ["objj", String(mainPath)].concat(system.args.slice(1)); +require("objective-j").run(args); diff --git a/Tools/capp/Generate.j b/Tools/capp/Generate.j index ba10684f7..5e3e7b8e1 100644 --- a/Tools/capp/Generate.j +++ b/Tools/capp/Generate.j @@ -6,6 +6,8 @@ var OS = require("os"), FILE = require("file"), OBJJ = require("objective-j"); +// FIXME: better way to do this: +var CAPP_HOME = require("packages").catalog["cappuccino"].directory; function gen(/*va_args*/) { @@ -56,7 +58,7 @@ function gen(/*va_args*/) if (FILE.isAbsolute(template)) sourceTemplate = FILE.join(template); else - sourceTemplate = FILE.join(SYSTEM.env["SELF_HOME"], "lib", "capp", "Resources", "Templates", template); + sourceTemplate = FILE.join(CAPP_HOME, "lib", "capp", "Resources", "Templates", template); var configFile = FILE.join(sourceTemplate, "template.config"), config = {};