Removed File and FileReader java classes from global namespace

This commit is contained in:
walterhiggins 2013-01-14 23:31:58 +00:00
parent 6c71a768a6
commit af5436cf82

View file

@ -12,16 +12,16 @@ ScriptCraft.core = ScriptCraft.core || {};
return ; return ;
var _originalScript = __script; var _originalScript = __script;
importPackage(java.io); //importPackage(java.io);
var _canonize = function(file){ var _canonize = function(file){
return file.getCanonicalPath().replaceAll("\\\\","/"); return file.getCanonicalPath().replaceAll("\\\\","/");
}; };
var _load = function(filename){ var _load = function(filename){
var file = new File(filename); var file = new java.io.File(filename);
print("loading " + _canonize(file)); print("loading " + _canonize(file));
if (file.exists()){ if (file.exists()){
var parent = file.getParentFile(); var parent = file.getParentFile();
var reader = new FileReader(file); var reader = new java.io.FileReader(file);
__engine.put("__script",_canonize(file)); __engine.put("__script",_canonize(file));
__engine.put("__folder",(parent?_canonize(parent):"")+"/"); __engine.put("__folder",(parent?_canonize(parent):"")+"/");
__engine.eval(reader); __engine.eval(reader);
@ -196,7 +196,7 @@ ScriptCraft.core = ScriptCraft.core || {};
// //
// assumes this was loaded from js-plugins/core/ // assumes this was loaded from js-plugins/core/
// //
reload(new File(__script).getParentFile().getParentFile()); reload(new java.io.File(__script).getParentFile().getParentFile());
}()); }());