var NwBuilder = require("node-webkit-builder");
var asap = require("pdenodeify");
var path = require("path");
var rimraf = require("rimraf");

module.exports = function(options, buildResult){
	var nwOptions = {};

	// Convert the options to camelcase
	Object.keys(options).forEach(function(optName){
		nwOptions[toCamelcase(optName)] = options[optName];
	});

	// Set the bundlesPath as a file to use.
	var files = nwOptions.files || nwOptions.glob || [];
	files = Array.isArray(files) ? files : [files];
	if(buildResult && buildResult.configuration &&
	   buildResult.configuration.bundlesPath) {
		var bundlesPath = buildResult.configuration.bundlesPath;
		files.unshift(path.join(bundlesPath, "**/*"));
	}
	nwOptions.files = files;

	var nw = new NwBuilder(nwOptions);

	nw.on("log", function(msg){
		console.error(msg);
	});

	var buildPromise = asap(rimraf)(nwOptions.buildDir);

	var builder = asap(nw.build.bind(nw));
	return buildPromise.then(builder);
};


function toCamelcase(str) {
	return str.replace(/\_+([a-z])/g, function (x, chr) { return chr.toUpperCase(); });
}

@@ -656,32 +656,52 @@
 ;%0A%09%09
-files.unshift(path.join(
+var globPath = path.relative(process.cwd(), 
 bund
@@ -711,17 +711,45 @@
 Path
-,
+) +
  %22
+/
 **/*%22
-)
+;%0A%09%09files.unshift(globPath
 );%0A%09

Use path.relative to create the bundles glob