Skip to content

Commit

Permalink
Make DML working on Windows (issue #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain Bellone committed Dec 7, 2017
1 parent ce7e79e commit c888d8d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions lib/dynamic_module_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var Future = require('futures').future;
var tar = require('tar');
var spawn = require('child_process').spawn;
var exec = require('child_process').exec;
var execFile = require('child_process').execFile;
var util = require('util');
var path = require('path');
Expand Down Expand Up @@ -1225,8 +1226,16 @@ var DynamicModuleLoader = new JS.Class(
var future = new Future();
var wrap = eh.createWrapperFromFuture(future);

execFile('find', [ rootDir, '-name', 'package.json' ], wrap(
function (stdout)
if(/^win/.test(process.platform))
{
exec('dir /B /S ' + rootDir + '\\package.json', wrap(getTopLevelFile));
}
else
{
execFile('find', [ rootDir, '-name', 'package.json' ], wrap(getTopLevelFile));
}

function getTopLevelFile (stdout)
{
stdout = _.str.trim(stdout);
if (stdout === "")
Expand All @@ -1243,7 +1252,7 @@ var DynamicModuleLoader = new JS.Class(
return left.length - right.length;
});
future.fulfill(undefined, files[0]);
}));
}

return future;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dynamic-module-loader",
"version": "1.3.2",
"version": "1.3.3",
"homepage": "https://github.com/VirtuOz/node-dynamic-module-loader",
"author": {
"name": "Kevan Dunsmore",
Expand Down

0 comments on commit c888d8d

Please sign in to comment.