You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bh...@apache.org on 2013/05/22 21:00:00 UTC
webworks commit: [CB-3437] Fix path issues in create and plugin
scripts
Updated Branches:
refs/heads/master a6902be33 -> dfc237101
[CB-3437] Fix path issues in create and plugin scripts
- Use path.resolve on project path before building paths
- Use path.join for all paths in create script
- Modify plugin script to invoke plugman using node.exe on windows
Reviewed by Bryan Higgins <bh...@blackberry.com>
Tested by Tracy Li <tl...@blackberry.com>
Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/dfc23710
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/dfc23710
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/dfc23710
Branch: refs/heads/master
Commit: dfc237101f5b2dcb4eaff15c0ce923efc4264e92
Parents: a6902be
Author: Hasan Ahmad <ha...@blackberry.com>
Authored: Wed May 22 11:26:53 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Wed May 22 14:48:42 2013 -0400
----------------------------------------------------------------------
blackberry10/bin/create.js | 14 +++++++-------
.../bin/templates/project/cordova/lib/plugin.js | 6 +++++-
2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/dfc23710/blackberry10/bin/create.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/create.js b/blackberry10/bin/create.js
index f2fc296..253c093 100644
--- a/blackberry10/bin/create.js
+++ b/blackberry10/bin/create.js
@@ -30,7 +30,7 @@ var build,
wrench = require("wrench"),
utils = require(path.join(__dirname, 'lib/utils')),
version = getVersion(),
- project_path = process.argv[2],
+ project_path = path.resolve(process.argv[2]),
app_id = process.argv[3],
bar_name = process.argv[4],
TARGETS = ["device", "simulator"],
@@ -46,9 +46,9 @@ var build,
js_basename = "cordova-" + version + ".js";
function getVersion() {
- var version = fs.readFileSync(__dirname + "/../VERSION");
+ var version = fs.readFileSync(path.join(__dirname, "..", "VERSION"));
if (version) {
- return version.toString().replace( /([^\x00-\xFF]|\s)*$/g, '' );//.replace("[^\u0000-\u007F]", ""); //.replace(/\W\./g, '');
+ return version.toString().replace( /([^\x00-\xFF]|\s)*$/g, '' );
}
}
@@ -89,7 +89,7 @@ function clean() {
}
function copyJavascript() {
- wrench.mkdirSyncRecursive(BUILD_DIR + "/" + js_path, 0777);
+ wrench.mkdirSyncRecursive(path.join(BUILD_DIR, js_path), 0777);
utils.copyFile(CORDOVA_JS_SRC, path.join(BUILD_DIR, js_path));
//rename copied cordova.blackberry10.js file
@@ -104,7 +104,7 @@ function copyFilesToProject() {
wrench.copyDirSyncRecursive(TEMPLATE_PROJECT_DIR, project_path);
// change file permission for cordova scripts because ant copy doesn't preserve file permissions
- wrench.chmodSyncRecursive(project_path + "/cordova", 0700);
+ wrench.chmodSyncRecursive(path.join(project_path,"cordova"), 0700);
//copy cordova-*version*.js to www
utils.copyFile(path.join(BUILD_DIR, js_path, js_basename), path.join(project_path, "www"));
@@ -131,8 +131,8 @@ function copyFilesToProject() {
}
function updateProject() {
- var projectJson = require(path.resolve(project_path + "/project.json")),
- configXMLPath = path.resolve(project_path + "/www/config.xml"),
+ var projectJson = require(path.resolve(path.join(project_path, "project.json"))),
+ configXMLPath = path.resolve(path.join(project_path, "www", "config.xml")),
xmlString;
if (typeof app_id !== "undefined") {
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/dfc23710/blackberry10/bin/templates/project/cordova/lib/plugin.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/plugin.js b/blackberry10/bin/templates/project/cordova/lib/plugin.js
index 8fab05b..1f11481 100644
--- a/blackberry10/bin/templates/project/cordova/lib/plugin.js
+++ b/blackberry10/bin/templates/project/cordova/lib/plugin.js
@@ -64,7 +64,11 @@ var path = require("path"),
return argumentor;
},
run: function () {
- var cmd = PLUGMAN + " " + this.args.join(" ");
+ var cmd = "";
+ if (require('os').type().toLowerCase().indexOf("windows") >= 0) {
+ cmd += "@node.exe ";
+ }
+ cmd += PLUGMAN + " " + this.args.join(" ");
return shell.exec(cmd, {silent: false});
}
},