Added logging of errors during plugin autoload.

This commit is contained in:
walterhiggins 2014-01-25 09:04:16 +00:00
parent 8c690452e7
commit 7a7767c83c
70 changed files with 14 additions and 14 deletions

View file

@ -75,8 +75,8 @@
<classpath> <classpath>
<pathelement path="src/docs/java"/> <pathelement path="src/docs/java"/>
</classpath> </classpath>
<arg value="src/docs/javascript/generateApiDocs.js"/> <arg value="src/docs/js/generateApiDocs.js"/>
<arg value="src/main/javascript"/> <arg value="src/main/js"/>
</java> </java>
</target> </target>
@ -103,7 +103,7 @@ Walter Higgins
<classpath> <classpath>
<pathelement path="src/docs/java"/> <pathelement path="src/docs/java"/>
</classpath> </classpath>
<arg value="src/docs/javascript/generateTOC.js"/> <arg value="src/docs/js/generateTOC.js"/>
<arg value="${dist}/apiref.md"/> <arg value="${dist}/apiref.md"/>
</java> </java>
</target> </target>
@ -113,7 +113,7 @@ Walter Higgins
<classpath> <classpath>
<pathelement path="src/docs/java"/> <pathelement path="src/docs/java"/>
</classpath> </classpath>
<arg value="src/docs/javascript/generateTOC.js"/> <arg value="src/docs/js/generateTOC.js"/>
<arg value="src/docs/templates/ypgpm.md"/> <arg value="src/docs/templates/ypgpm.md"/>
</java> </java>
</target> </target>
@ -134,7 +134,7 @@ Walter Higgins
<target name="zip_lib" depends="init"> <target name="zip_lib" depends="init">
<delete file="${build}/lib.zip"/> <delete file="${build}/lib.zip"/>
<zip destfile="${build}/lib.zip" <zip destfile="${build}/lib.zip"
basedir="./src/main/javascript" basedir="./src/main/js"
excludes="modules/**, plugins/**,"> excludes="modules/**, plugins/**,">
</zip> </zip>
</target> </target>
@ -142,7 +142,7 @@ Walter Higgins
<target name="zip_modules" depends="init"> <target name="zip_modules" depends="init">
<delete file="${build}/modules.zip"/> <delete file="${build}/modules.zip"/>
<zip destfile="${build}/modules.zip" <zip destfile="${build}/modules.zip"
basedir="./src/main/javascript" basedir="./src/main/js"
excludes="lib/**, plugins/**,"> excludes="lib/**, plugins/**,">
</zip> </zip>
</target> </target>
@ -150,7 +150,7 @@ Walter Higgins
<target name="zip_plugins" depends="init"> <target name="zip_plugins" depends="init">
<delete file="${build}/plugins.zip"/> <delete file="${build}/plugins.zip"/>
<zip destfile="${build}/plugins.zip" <zip destfile="${build}/plugins.zip"
basedir="./src/main/javascript" basedir="./src/main/js"
excludes="lib/**, modules/**"> excludes="lib/**, modules/**">
</zip> </zip>
</target> </target>

View file

@ -13,7 +13,7 @@ var _plugin = function(/* String */ moduleName, /* Object */ moduleObject, isPer
// //
// don't load plugin more than once // don't load plugin more than once
// //
if (typeof _plugins[moduleName] != "undefined") if (typeof _plugins[moduleName] != 'undefined')
return _plugins[moduleName].module; return _plugins[moduleName].module;
var pluginData = {persistent: isPersistent, module: moduleObject}; var pluginData = {persistent: isPersistent, module: moduleObject};
@ -34,14 +34,14 @@ var scriptCraftDir = null;
var pluginDir = null; var pluginDir = null;
var dataDir = null; var dataDir = null;
exports.autoload = function(dir) { exports.autoload = function(dir,logger) {
scriptCraftDir = dir; scriptCraftDir = dir;
pluginDir = new File(dir, "plugins"); pluginDir = new File(dir, 'plugins');
dataDir = new File(dir, "data"); dataDir = new File(dir, 'data');
var _canonize = function(file){ var _canonize = function(file){
return '' + file.canonicalPath.replaceAll("\\\\","/"); return '' + file.canonicalPath.replaceAll('\\\\','/');
}; };
/* /*
recursively walk the given directory and return a list of all .js files recursively walk the given directory and return a list of all .js files
@ -85,7 +85,7 @@ exports.autoload = function(dir) {
global[property] = module[property]; global[property] = module[property];
} }
}catch (e){ }catch (e){
logger.severe('Plugin ' + pluginPath + ' ' + e);
} }
} }
}; };

View file

@ -625,7 +625,7 @@ function __onEnable (__engine, __plugin, __script)
return result; return result;
}; };
plugins.autoload(jsPluginsRootDir); plugins.autoload(jsPluginsRootDir,logger);
/* /*
wph 20140102 - warn if legacy 'craftbukkit/js-plugins' or 'craftbukkit/scriptcraft' directories are present wph 20140102 - warn if legacy 'craftbukkit/js-plugins' or 'craftbukkit/scriptcraft' directories are present
*/ */