g.fs.get_cache_dir: Ensure the dir exists

This makes get_cache_dir() try to ensure the cache directory that it
returns exists.

Should-fix: https://github.com/awesomeWM/awesome/issues/1663
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-04-02 18:56:24 +02:00
parent 4bbedebea4
commit 48c15e4dfb
1 changed files with 3 additions and 1 deletions

View File

@ -103,7 +103,9 @@ end
--- Get the path to a directory that should be used for caching data.
-- @return A string with the requested path with a slash at the end.
function filesystem.get_cache_dir()
return filesystem.get_xdg_cache_home() .. "awesome/"
local result = filesystem.get_xdg_cache_home() .. "awesome/"
filesystem.mkdir(result)
return result
end
--- Get the path to the directory where themes are installed.