removed unneeded getCanonicalPath() call

This commit is contained in:
walterhiggins 2013-01-06 21:31:37 +00:00
parent 5ae9837901
commit d2a3b637aa

View file

@ -1,6 +1,6 @@
package net.walterhiggins.scriptcraft; package net.walterhiggins.scriptcraft;
import java.io.File; import java.io.File;
import java.io.IOException;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.command.*; import org.bukkit.command.*;
import org.mozilla.javascript.*; import org.mozilla.javascript.*;
@ -29,28 +29,21 @@ public class ScriptCraftPlugin extends JavaPlugin
} }
} }
} }
//
// called recursively to load all js plugins in the js-plugins directory and
// sub-directories
//
private void loadJsPlugins (File directory){ private void loadJsPlugins (File directory){
File[] files = directory.listFiles(); File[] files = directory.listFiles();
for (File f: files){ for (File f: files){
String canonicalPath = null;
try {
this.getLogger().info("Loading javascript source file " + f);
if (f.isDirectory()){ if (f.isDirectory()){
loadJsPlugins(f); loadJsPlugins(f);
}else{ }else{
// if (f.getAbsolutePath().endsWith(".js")){
// fix for bug #11 this.getLogger().info("Loading javascript source file " + f);
//
canonicalPath = f.getCanonicalPath().replaceAll("\\\\", "/");
if (canonicalPath.endsWith(".js")){
ScriptCraftEvaluator.loadJsFile(f,this.evaluator.ctx,this.evaluator.scope); ScriptCraftEvaluator.loadJsFile(f,this.evaluator.ctx,this.evaluator.scope);
} }
} }
}catch(IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} }
} }
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)