use separate index files

This commit is contained in:
jane 2021-06-06 00:59:12 -04:00
parent 721db1cd90
commit b4bf491b83
2 changed files with 5 additions and 3 deletions

View file

@ -68,9 +68,10 @@ local function getAllFiles(program)
local resultText = result.readAll() local resultText = result.readAll()
local resultTable = split(resultText, "\n") local resultTable = split(resultText, "\n")
local indexesFile = fs.open("bin/indexes.dat", "w") local indexesFile = fs.open(path .. program .. "/indexes.dat", "w")
indexesFile.write(resultText) indexesFile.write(resultText)
indexesFile.close() indexesFile.close()
print("wrote indexes for " .. program)
local programsFile = fs.open(path .. "programs.dat", "a") local programsFile = fs.open(path .. "programs.dat", "a")
programsFile.write(program) programsFile.write(program)

View file

@ -59,7 +59,7 @@ local function getAllFiles(program)
local currentFiles = "" local currentFiles = ""
if fs.exists(path .. "indexes.dat") then if fs.exists(path .. "indexes.dat") then
local indexesFile = fs.open(path .. "indexes.dat", "r") local indexesFile = fs.open(path .. program .. "/indexes.dat", "r")
currentFiles = indexesFile.readAll() currentFiles = indexesFile.readAll()
indexesFile.close() indexesFile.close()
end end
@ -80,9 +80,10 @@ local function getAllFiles(program)
local resultText2 = result2.readAll() local resultText2 = result2.readAll()
local resultTable2 = split(resultText2, "\n") local resultTable2 = split(resultText2, "\n")
local newIndexesFile = fs.open(path .. "indexes.dat", "w") local newIndexesFile = fs.open(path .. program .. "/indexes.dat", "w")
newIndexesFile.write(resultText) newIndexesFile.write(resultText)
newIndexesFile.close() newIndexesFile.close()
print("wrote new indexes for " .. program)
local finalResult = {} local finalResult = {}
for key, value in ipairs(resultTable2) do for key, value in ipairs(resultTable2) do