How to use the nw.findpath function in nw

To help you get started, we’ve selected a few nw examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Dineshs91 / devlog / test / protractor-conf.js View on Github external
'use strict';

var path = require('path');
var nw = require('nw');

exports.config = {
    chromeDriver: './support/chromedriver',
    directConnect: true,
    specs: ['e2e/**/*.js'],
    baseUrl: 'file://' + path.resolve('app/index.html'),
    rootElement: 'html',
    capabilities: {
        browserName: 'chrome',
        chromeOptions: {
            binary: nw.findpath()
        }
    },

    onPrepare: function() {

        // By default, Protractor use data:text/html, as resetUrl, but 
        // location.replace (see http://git.io/tvdSIQ) from the data: to the file: protocol is not allowed
        // (we'll get ‘not allowed local resource’ error), so we replace resetUrl with one
        // with the file: protocol (this particular one will open system's root folder)
        browser.resetUrl = 'file://';

        // This isn't required and used to avoid ‘Cannot extract package’ error showed
        // before Protractor have redirected node-webkit to resetUrl.
        browser.driver.get('file://');
        browser.driver.get('file://' + path.resolve('app/index.html'));
    }
github szwacz / nw-boilerplate / tasks / start.js View on Github external
var runApp = function () {
    var app = childProcess.spawn(nw.findpath(), ['./build'], {
        stdio: 'inherit'
    });

    app.on('close', function (code) {
        // User closed the app. Kill the host process.
        kill(watch.pid, 'SIGKILL', function () {
            process.exit();
        });
    });
};
github Oletus / gameutils.js / tools / template-files / tools / compile-js.js View on Github external
var appendNWJSZipToNWExe = function(callback) {
    if (process.platform !== 'win32') {
        console.log('Creating nw.js based exe on other platforms than Windows not supported.');
        return;
    }
    var nwpath = nwfindpath();
    var nwSourceDir = path.dirname(nwpath);
    var packageNwSourcePath = path.join(outDirNWJS, 'package.nw');

    var exeOutDir = path.join(outDirNWJS, 'win');
    if (fs.existsSync(exeOutDir)) {
        fse.removeSync(exeOutDir);
    }
    fse.copy(nwSourceDir, exeOutDir, function() {
        var nwExePath = path.join(exeOutDir, 'nw.exe');
        var outputExeName = packageJson.name + '.exe';
        var outputExePath = path.join(exeOutDir, outputExeName);

        // Alternative: just copy the package.nw into place and rename the exe.
        //fse.copySync(packageNwSourcePath + path.join(exeOutDir, 'package.nw');
        //fse.moveSync(nwExePath, outputExePath);
github monaca / monaca-cli / src / sync.js View on Github external
(dir) => {
      projectDir= dir;
      lib.needToUpgrade(projectDir, monaca);

      // if it is transpile project but doesn't has the watch script, it should be failed
      if (monaca.hasTranspileScript(projectDir) && !monaca.hasDebugScript(projectDir)) util.fail('Please create \'monaca:debug\' script to transpile and watch the file changes in \'package.json\' ');

      try {
        var nw = path.join(projectDir, 'node_modules', 'nw');
        var nwBin = require(nw).findpath();
        var adbPath =  path.join(__dirname, '..', 'bin', process.platform, (process.platform == "win32") ? 'adb.exe' : 'adb');

        localkit.initInspector({
          inspectorCallback: function(result) {
            child_process.spawn(nwBin, [result.app, result.webSocketUrl]);
          },
          adbPath: adbPath
        });
      } catch (error) {
        if ( error.code === 'MODULE_NOT_FOUND' ) {
          nwError = true;
        }
      }

      var projects = argv._.slice(1);
github daftspunk / pond / version0 / tasks / dev.js View on Github external
var runApp = function () {
    console.log(nw.findpath())
    var env = Object.create(process.env);
    env.NODE_ENV = 'dev';

    var app = childProcess.spawn(nw.findpath(), ['./app'], {
        stdio: 'inherit',
        env: env
    });
};
github daftspunk / pond / version0 / tasks / dev.js View on Github external
var runApp = function () {
    console.log(nw.findpath())
    var env = Object.create(process.env);
    env.NODE_ENV = 'dev';

    var app = childProcess.spawn(nw.findpath(), ['./app'], {
        stdio: 'inherit',
        env: env
    });
};
github zachatrocity / Pinpoint / tasks / build.js View on Github external
gulp.task('run', function(){
    var app = childProcess.spawn(nw.findpath(), ['./'], {
        stdio: 'inherit'
    });
})