fixed module unloading

This commit is contained in:
Luke Slater 2012-12-11 20:27:18 +00:00
parent 1f2c7fa835
commit f72e29398f

View File

@ -80,7 +80,8 @@ var admin = function(dbot) {
'unload': function(event) { 'unload': function(event) {
var moduleName = event.params[1]; var moduleName = event.params[1];
if(dbot.moduleNames.include(moduleName)) { if(dbot.moduleNames.include(moduleName)) {
var cacheKey = require.resolve('../modules/' + moduleName); var moduleDir = '../' + moduleName + '/';
var cacheKey = require.resolve(moduleDir + moduleName);
delete require.cache[cacheKey]; delete require.cache[cacheKey];
var moduleIndex = dbot.moduleNames.indexOf(moduleName); var moduleIndex = dbot.moduleNames.indexOf(moduleName);