Mercurial Hosting > luan
changeset 768:ef0fc9ad30c1
add file.set_last_modified()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 07 Aug 2016 21:03:14 -0600 |
parents | fec01f044474 |
children | c5f5b655f1f7 |
files | core/src/luan/modules/IoLuan.java |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r fec01f044474 -r ef0fc9ad30c1 core/src/luan/modules/IoLuan.java --- a/core/src/luan/modules/IoLuan.java Mon Aug 01 01:44:39 2016 -0600 +++ b/core/src/luan/modules/IoLuan.java Sun Aug 07 21:03:14 2016 -0600 @@ -520,6 +520,11 @@ } } + public void set_last_modified(long time) throws LuanException { + if( !file.setLastModified(time) ) + throw new LuanException("couldn't set_last_modified on "+file); + } + @Override public LuanTable table() { LuanTable tbl = super.table(); try { @@ -544,6 +549,9 @@ tbl.rawPut( "last_modified", new LuanJavaFunction( File.class.getMethod( "lastModified" ), file ) ); + tbl.rawPut( "set_last_modified", new LuanJavaFunction( + LuanFile.class.getMethod( "set_last_modified", Long.TYPE ), this + ) ); tbl.rawPut( "length", new LuanJavaFunction( File.class.getMethod( "length" ), file ) );