From d338eff00d778fce40f9416474a68158ee67ba74 Mon Sep 17 00:00:00 2001 From: Tigran Aivazian Date: Mon, 24 Sep 2012 09:04:57 +0100 Subject: [PATCH] Don't write to temporary file on the flash device. Instead of writing to (and reading from) the temporary file "history/.history.txt" create a pipe to the appropriate process and read from it. --- filehistory.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/filehistory.lua b/filehistory.lua index d95d94959..cf2e5b6db 100644 --- a/filehistory.lua +++ b/filehistory.lua @@ -51,9 +51,8 @@ end function FileHistory:readDir(order_criteria) self.history_files = {} self.files = {} - local listfile = self.path.."/.history.txt" - os.execute("ls "..order_criteria.."-1 "..self.path.." > "..listfile) - for f in io.lines(listfile) do + local p = io.popen("ls "..order_criteria.."-1 "..self.path) + for f in p:lines() do -- insert history files file_entry = {dir=self.path, name=f} table.insert(self.history_files, file_entry) @@ -61,6 +60,7 @@ function FileHistory:readDir(order_criteria) file_entry = {dir=HistoryToPath(f), name=HistoryToName(f)} table.insert(self.files, file_entry) end + p:close() end function FileHistory:setSearchResult(keywords)