Skip to content

Commit

Permalink
Fix mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
Advers committed Sep 7, 2024
1 parent 2d8136d commit e0fdbff
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lua/starfall/libs_cl/file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,17 @@ function file_library.delete(path)
end

--- Deletes a temp file
-- @param filename path The temp file name. Must be only a file and not a path
-- @param string filename The temp file name. Must be only a file and not a path
-- @return boolean? True if successful, nil if it wasn't found
function file_library.deleteTemp(path)
checkpermission (instance, path, "file.writeTemp")
function file_library.deleteTemp(filename)
checkpermission (instance, nil, "file.writeTemp")
checkluatype (path, TYPE_STRING)
path = "sf_filedatatemp/"..instance.player:SteamID64().."/" .. SF.NormalizePath(path)

if #filename > 128 then SF.Throw("Filename is too long!", 2) end
checkExtension(filename)
filename = string.lower(string.GetFileFromFilename(filename))

local path = "sf_filedatatemp/"..instance.player:SteamID64().."/"..filename
if file.Exists(path, "DATA") then
file.Delete(path)
return true
Expand Down

0 comments on commit e0fdbff

Please sign in to comment.