support/watcher.js
function normalPushADB(fileName, options, callback) {
    if (typeof options === "function") {
        callback = options;
        options = null;
    }
    var srcFile = fileName;
    if (options && typeof options.srcFile === "string") {
        srcFile = options.srcFile;
    }

    var check = false;
    if (options && options.check) {
        check = true;
    }
    var quiet = false;
    if (options && options.quiet) {
        quiet = true;
    }

    var path = "/data/data/" + projectData.nativescript.id + "/files/" + fileName;
    cp.exec('adb push "'+srcFile+'" "' + path + '"', {timeout: 10000}, function(err, sout, serr) {
        if (err) {

            if (sout.indexOf('Permission denied') > 0) { pushADB = backupPushADB; console.log("Using backup method for updates!"); }
            if (serr.indexOf('Permission denied') > 0) { pushADB = backupPushADB; console.log("Using backup method for updates!"); }
            if (check !== true) {
                console.log("Failed to Push to Device: ", fileName);
                console.log(err);
                //console.log(sout);
                //console.log(serr);
            }
        } else if (check !== true && quiet === false ) {
            console.log("Pushed to Device: ", fileName);
        }
        if (callback) {
            callback(err);
        }
    });
}
function normalPushADB(fileName, options, callback) {
    if (typeof options === "function") {
        callback = options;
        options = null;
    }
    var srcFile = fileName;
    if (options && typeof options.srcFile === "string") {
        srcFile = options.srcFile;
    }

    var check = false;
    if (options && options.check) {
        check = true;
    }
    var quiet = false;
    if (options && options.quiet) {
        quiet = true;
    }

    var path = "/data/data/" + projectData.nativescript.id + "/files/" + fileName;
    cp.exec('adb push "'+srcFile+'" "' + path + '"', {timeout: 10000}, function(err, sout, serr) {
        if (err) {

            if (sout.indexOf('Permission denied') > 0) { pushADB = backupPushADB; console.log("Using backup method for updates!"); }
            if (serr.indexOf('Permission denied') > 0) { pushADB = backupPushADB; console.log("Using backup method for updates!"); }
            if (check !== true) {
                console.log("Failed to Push to Device: ", fileName);
                console.log(err);
                //console.log(sout);
                //console.log(serr);
            }
        } else if (check !== true && quiet === false ) {
            console.log("Pushed to Device: ", fileName);
        }
        if (callback) {
            callback(err);
        }
    });
}
function normalPushADB ( fileName , options , callback ) { if ( typeof options === "function" ) { callback = options ; options = null ; } var srcFile = fileName ; if ( options && typeof options . srcFile === "string" ) { srcFile = options . srcFile ; } var check = false ; if ( options && options . check ) { check = true ; } var quiet = false ; if ( options && options . quiet ) { quiet = true ; } var path = "/data/data/" + projectData . nativescript . id + "/files/" + fileName ; cp . exec ( 'adb push "' + srcFile + '" "' + path + '"' , { timeout : 10000 } , function ( err , sout , serr ) { if ( err ) { if ( sout . indexOf ( 'Permission denied' ) > 0 ) { pushADB = backupPushADB ; console . log ( "Using backup method for updates!" ) ; } if ( serr . indexOf ( 'Permission denied' ) > 0 ) { pushADB = backupPushADB ; console . log ( "Using backup method for updates!" ) ; } if ( check !== true ) { console . log ( "Failed to Push to Device: " , fileName ) ; console . log ( err ) ; //console.log(sout); //console.log(serr); } } else if ( check !== true && quiet === false ) { console . log ( "Pushed to Device: " , fileName ) ; } if ( callback ) { callback ( err ) ; } } ) ; }
This runs the adb command so that we can push the file up to the emulator or device
@param fileName
@param options
@param callback
This runs the adb command so that we can push the file up to the emulator or device