comparison core/src/luan/modules/IoLuan.java @ 293:a50e88d3547c

add Web_server.init(); add File.rename_to(); git-svn-id: https://luan-java.googlecode.com/svn/trunk@294 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Thu, 11 Dec 2014 01:44:38 +0000
parents b669cdaf54b7
children 7ea6dfdf81ba
comparison
equal deleted inserted replaced
292:e8a2153f6ce1 293:a50e88d3547c
402 402
403 @Override public boolean exists() { 403 @Override public boolean exists() {
404 return file.exists(); 404 return file.exists();
405 } 405 }
406 406
407 public boolean rename_to(String dest) {
408 return file.renameTo(new File(dest));
409 }
410
407 @Override LuanTable table() { 411 @Override LuanTable table() {
408 LuanTable tbl = super.table(); 412 LuanTable tbl = super.table();
409 try { 413 try {
410 tbl.put( "name", new LuanJavaFunction( 414 tbl.put( "name", new LuanJavaFunction(
411 File.class.getMethod( "getName" ), file 415 File.class.getMethod( "getName" ), file
431 tbl.put( "child", new LuanJavaFunction( 435 tbl.put( "child", new LuanJavaFunction(
432 LuanFile.class.getMethod( "child", LuanState.class, String.class ), this 436 LuanFile.class.getMethod( "child", LuanState.class, String.class ), this
433 ) ); 437 ) );
434 tbl.put( "children", new LuanJavaFunction( 438 tbl.put( "children", new LuanJavaFunction(
435 LuanFile.class.getMethod( "children", LuanState.class ), this 439 LuanFile.class.getMethod( "children", LuanState.class ), this
440 ) );
441 tbl.put( "rename_to", new LuanJavaFunction(
442 LuanFile.class.getMethod( "rename_to", String.class ), this
436 ) ); 443 ) );
437 } catch(NoSuchMethodException e) { 444 } catch(NoSuchMethodException e) {
438 throw new RuntimeException(e); 445 throw new RuntimeException(e);
439 } 446 }
440 return tbl; 447 return tbl;