utility.tmp_file_name function added

This commit is contained in:
Tangent / Rose / Nebula Rosa 2024-01-13 15:43:38 -07:00
parent a5a8e3a5f3
commit 72f059506c

View File

@ -3,7 +3,7 @@ math.randomseed(os.time())
-- TODO look for popen command and fall back to outputting to file if its unavailable
function os.command(command)
local file = assert(io.popen(command, 'r'))
local output = assert(file:read('*a'))
local output = assert(file:read('*all'))
file:close()
return output
end
@ -32,6 +32,10 @@ utility.uuid = function()
return (("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"):gsub("[xy]", fn))
end
utility.tmp_file_name = function()
return ".tmp." .. utility.uuid()
end
utility.escape_quotes = function(input)
input = input:gsub("\\", "\\\\")
input = input:gsub("\"", "\\\"")