removed unneeded getCanonicalPath() call
This commit is contained in:
parent
5ae9837901
commit
d2a3b637aa
1 changed files with 14 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
|||
package net.walterhiggins.scriptcraft;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.command.*;
|
||||
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){
|
||||
File[] files = directory.listFiles();
|
||||
for (File f: files){
|
||||
String canonicalPath = null;
|
||||
try {
|
||||
this.getLogger().info("Loading javascript source file " + f);
|
||||
if (f.isDirectory()){
|
||||
loadJsPlugins(f);
|
||||
}else{
|
||||
//
|
||||
// fix for bug #11
|
||||
//
|
||||
canonicalPath = f.getCanonicalPath().replaceAll("\\\\", "/");
|
||||
if (canonicalPath.endsWith(".js")){
|
||||
if (f.getAbsolutePath().endsWith(".js")){
|
||||
this.getLogger().info("Loading javascript source file " + f);
|
||||
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)
|
||||
|
|
Reference in a new issue