Merge pull request #4314 from BigFunger/require-plugins-windowz

Fixed paths for plugins in windows
This commit is contained in:
Chris Cowan 2015-06-26 13:10:55 -07:00
commit c39cd847a9
2 changed files with 7 additions and 6 deletions

View file

@ -6,6 +6,7 @@ var plugins = function (dir) {
if (!dir) return [];
var files = glob.sync(path.join(dir, '*', 'index.js')) || [];
return files.map(function (file) {
dir = dir.replace(/\\/g, '/');
return file.replace(dir, 'plugins').replace(/\.js$/, '');
});
};
@ -23,5 +24,4 @@ module.exports = function (server) {
cache = bundled_plugin_ids.concat(bundled_plugins, external_plugins);
}
return cache;
};
};

View file

@ -5,17 +5,18 @@ var Promise = require('bluebird');
var checkPath = require('../config/check_path');
module.exports = function (globPath) {
globPath = globPath || join( __dirname, '..', '..', 'plugins', '*', 'index.js');
globPath = globPath || join(__dirname, '..', '..', 'plugins', '*', 'index.js');
return glob.sync(globPath).map(function (file) {
var module = require(file);
var regex = new RegExp('([^' + path.sep + ']+)' + path.sep + 'index.js');
var regex = new RegExp('([^/]+)/index.js');
var matches = file.match(regex);
if (!module.name && matches) {
module.name = matches[1];
}
// has a public folder?
var publicPath = module.publicPath || join(path.dirname(file), 'public');
var publicPath = (module.publicPath || join(path.dirname(file), 'public')).replace(/\\/g, '/');
if (checkPath(publicPath)) {
module.publicPath = publicPath;
if (!module.publicPlugins) {
@ -28,4 +29,4 @@ module.exports = function (globPath) {
return module;
});
};
};