You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mm...@apache.org on 2014/11/25 03:29:34 UTC
[3/3] cordova-browser git commit: CB-7978 Cleaning code and creating
temporary dir - Using path.resolve and path.join instead of concatenating
paths - Fixing error when temporary dir already exists by using shelljs
instead of fs
CB-7978 Cleaning code and creating temporary dir
- Using path.resolve and path.join instead of concatenating paths
- Fixing error when temporary dir already exists by using shelljs instead of fs
Project: http://git-wip-us.apache.org/repos/asf/cordova-browser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-browser/commit/86f08b8a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-browser/tree/86f08b8a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-browser/diff/86f08b8a
Branch: refs/heads/master
Commit: 86f08b8a3e4f2a7d019ae61e963dc2c3172cf427
Parents: 8f86509
Author: Victor Sosa <so...@gmail.com>
Authored: Mon Nov 24 16:44:13 2014 -0600
Committer: Victor Sosa <so...@gmail.com>
Committed: Mon Nov 24 16:44:13 2014 -0600
----------------------------------------------------------------------
bin/templates/project/cordova/run | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/86f08b8a/bin/templates/project/cordova/run
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/run b/bin/templates/project/cordova/run
index 9f9ccaf..1c2c17d 100755
--- a/bin/templates/project/cordova/run
+++ b/bin/templates/project/cordova/run
@@ -20,16 +20,18 @@
*/
var shell = require('shelljs'),
- fs = require('fs');
+ fs = require('fs'),
+ path = require('path');
-var configFile = shell.pwd() + '/config.xml';
-var configXML = fs.readFileSync(configFile, 'utf8');
-var sourceFile = /<content[\s\S]*?src\s*=\s*"(.*?)"/i.exec(configXML);
-var spawn = require('child_process').spawn,
+var configFile = path.resolve(path.join(shell.pwd(), 'config.xml')),
+ configXML = fs.readFileSync(configFile, 'utf8'),
+ sourceFile = /<content[\s\S]*?src\s*=\s*"(.*?)"/i.exec(configXML),
+ spawn = require('child_process').spawn,
tmpDir = '/tmp/temp_chrome_user_data_dir_for_cordova_browser/',
- project = 'file://' + shell.pwd() + '/platforms/browser/www/' + sourceFile[1];
+ project = 'file://' + path.resolve(path.join('platforms', 'browser', 'www', sourceFile[1]));
+
+shell.mkdir('-p', tmpDir);
-fs.mkdir(tmpDir);
switch (process.platform) {
case 'linux':
var args = ['--disable-web-security', '--user-data-dir=/tmp/temp_chrome_user_data_dir_for_cordova_browser', project];
@@ -37,6 +39,7 @@ switch (process.platform) {
chromeProcess.on('close', function(code) {
if (code != 0) {
+ console.log('chrome process failed to start. Using google-chrome instead');
var out = fs.openSync(tmpDir + 'out.log', 'a'),
err = fs.openSync(tmpDir + 'out.log', 'a'),
options = {detached: true, stdio: ['ignore', out, err]},
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org