Node Webkit – get working directory

'use strict';
 
angular
    .module('core', [])
    .constant('BASE_DIR', (function () {
 
        var $baseDir = null;
 
        if ('undefined' !== typeof(require)) {
            var path = require('path'),
                nwPath = process.execPath;
 
            $baseDir = path.dirname(nwPath);
        }
 
        return $baseDir;
 
    })());

References