diff --git a/src/spm/spm.lua b/src/spm/spm.lua index 5405cf3..a5bf14d 100644 --- a/src/spm/spm.lua +++ b/src/spm/spm.lua @@ -493,8 +493,8 @@ local function uninstallPackage(requestedPackage) end term.write("Removing package files...") - for i, j in pairs(locallyInstalledFiles[requestedPackage]) do - fs.remove(j) + for installedFilePath, fileLocalInstallPath in pairs(locallyInstalledFiles[requestedPackage]) do + fs.remove(fileLocalInstallPath) end term.write("Done\nRemoving references...") @@ -504,19 +504,19 @@ local function uninstallPackage(requestedPackage) print("Successfully uninstalled package " .. requestedPackage) end -local function updatePackage(pack) - if pack == "all" then +local function updatePackage(requestedPackage) + if requestedPackage == "all" then print("Updating everything...") - local tFiles = readFromLocalInstallFile() - if not tFiles then + local locallyInstalledPackages = readFromLocalInstallFile() + if not locallyInstalledPackages then io.stderr:write("Error while trying to read package names") return - elseif tFiles[1] == -1 then - table.remove(tFiles, 1) + elseif locallyInstalledPackages[1] == -1 then + table.remove(locallyInstalledPackages, 1) end local done = false - for i in pairs(tFiles) do - installPackage(i, nil, true) + for localPackage in pairs(locallyInstalledPackages) do + installPackage(localPackage, nil, true) done = true end if not done then