Mercurial Hosting > luan
comparison src/luan/lib/OsLib.java @ 160:138b9baee80b
include IoLib.LuanFile fns in OsLib.LuanFile;
improve PickleClient error output;
git-svn-id: https://luan-java.googlecode.com/svn/trunk@161 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 19 Jun 2014 07:02:16 +0000 |
parents | cc3a0578edac |
children | d310ebf4d6e7 |
comparison
equal
deleted
inserted
replaced
159:0abc9181061a | 160:138b9baee80b |
---|---|
39 | 39 |
40 public LuanTable child(String name) { | 40 public LuanTable child(String name) { |
41 return new LuanFile(new File(file,name)).table(); | 41 return new LuanFile(new File(file,name)).table(); |
42 } | 42 } |
43 | 43 |
44 public LuanTable io_file() { | |
45 return new IoLib.LuanFile(file).table(); | |
46 } | |
47 | |
48 public LuanTable children() { | 44 public LuanTable children() { |
49 File[] files = file.listFiles(); | 45 File[] files = file.listFiles(); |
50 if( files==null ) | 46 if( files==null ) |
51 return null; | 47 return null; |
52 LuanTable list = new LuanTable(); | 48 LuanTable list = new LuanTable(); |
55 } | 51 } |
56 return list; | 52 return list; |
57 } | 53 } |
58 | 54 |
59 LuanTable table() { | 55 LuanTable table() { |
60 LuanTable tbl = new LuanTable(); | 56 LuanTable tbl = new IoLib.LuanFile(file).table(); |
61 try { | 57 try { |
62 tbl.put( "to_string", new LuanJavaFunction( | |
63 File.class.getMethod( "toString" ), file | |
64 ) ); | |
65 tbl.put( "name", new LuanJavaFunction( | 58 tbl.put( "name", new LuanJavaFunction( |
66 File.class.getMethod( "getName" ), file | 59 File.class.getMethod( "getName" ), file |
67 ) ); | 60 ) ); |
68 tbl.put( "exists", new LuanJavaFunction( | 61 tbl.put( "exists", new LuanJavaFunction( |
69 File.class.getMethod( "exists" ), file | 62 File.class.getMethod( "exists" ), file |
87 File.class.getMethod( "lastModified" ), file | 80 File.class.getMethod( "lastModified" ), file |
88 ) ); | 81 ) ); |
89 tbl.put( "child", new LuanJavaFunction( | 82 tbl.put( "child", new LuanJavaFunction( |
90 LuanFile.class.getMethod( "child", String.class ), this | 83 LuanFile.class.getMethod( "child", String.class ), this |
91 ) ); | 84 ) ); |
92 tbl.put( "io_file", new LuanJavaFunction( | |
93 LuanFile.class.getMethod( "io_file" ), this | |
94 ) ); | |
95 tbl.put( "children", new LuanJavaFunction( | 85 tbl.put( "children", new LuanJavaFunction( |
96 LuanFile.class.getMethod( "children" ), this | 86 LuanFile.class.getMethod( "children" ), this |
97 ) ); | 87 ) ); |
98 } catch(NoSuchMethodException e) { | 88 } catch(NoSuchMethodException e) { |
99 throw new RuntimeException(e); | 89 throw new RuntimeException(e); |