From 48c15e4dfb5c695666e85ef26cdbf052b3f38a89 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 2 Apr 2017 18:56:24 +0200 Subject: [PATCH] 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 --- lib/gears/filesystem.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gears/filesystem.lua b/lib/gears/filesystem.lua index 3bbbfc1a..ffc83fee 100644 --- a/lib/gears/filesystem.lua +++ b/lib/gears/filesystem.lua @@ -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.