21 lines
428 B
Lua
21 lines
428 B
Lua
local utils = {}
|
|
|
|
function utils.readfile(command)
|
|
local file = io.open(command)
|
|
if not file then return nil end
|
|
local text = file:read('*all')
|
|
file:close()
|
|
return text:gsub("^%s*(.-)%s*$", "%1")
|
|
end
|
|
|
|
function utils.file_exists(name)
|
|
local f=io.open(name,"r")
|
|
if f~=nil then io.close(f) return true else return false end
|
|
end
|
|
|
|
function utils.home()
|
|
return os.getenv("HOME") .. "/"
|
|
end
|
|
|
|
return utils
|