diff lucene/src/luan/modules/lucene/Lucene.luan @ 746:293c397e8dee

improve zip
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 14 Jul 2016 19:36:02 -0600
parents 01e68da6983b
children de2418d11786
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/Lucene.luan	Wed Jul 13 21:27:23 2016 -0600
+++ b/lucene/src/luan/modules/lucene/Lucene.luan	Thu Jul 14 19:36:02 2016 -0600
@@ -5,8 +5,10 @@
 local type = Luan.type or error()
 local Html = require "luan:Html.luan"
 local Io = require "luan:Io.luan"
+local uri = Io.uri or error()
 local String = require "luan:String.luan"
 local matches = String.matches or error()
+local Table = require "luan:Table.luan"
 local LuceneIndex = require "java:luan.modules.lucene.LuceneIndex"
 local NumberFieldParser = require "java:luan.modules.lucene.queryparser.NumberFieldParser"
 local StringFieldParser = require "java:luan.modules.lucene.queryparser.StringFieldParser"
@@ -105,9 +107,10 @@
 		index.snapshot( function(dir,file_names)
 			local t = {}
 			for _, file_name in ipairs(file_names) do
-				t[file_name] = "file:"..dir.."/"..file_name
+				t[#t+1] = dir.."/"..file_name
 			end
-			Io.zip(zip_file,t)
+			local base = uri("file:"..dir).parent().to_string()
+			uri(zip_file).zip(base,Table.unpack(t))
 		end )
 	end