From 4bbedebea49180bdca2920cd4a206fb820efc6f1 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 2 Apr 2017 18:54:08 +0200 Subject: [PATCH] awful.prompt: Use g.filesystem.make_parent_dir() The changes should not actually make a difference. If creating the directory fails, the error will now be different, but that should be about it. Signed-off-by: Uli Schlachter --- lib/awful/prompt.lua | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/awful/prompt.lua b/lib/awful/prompt.lua index 0755f03c0..a61016e7f 100644 --- a/lib/awful/prompt.lua +++ b/lib/awful/prompt.lua @@ -210,15 +210,8 @@ end -- @param id The data.history identifier local function history_save(id) if data.history[id] then - local f = io.open(id, "w") - if not f then - local i = 0 - for d in id:gmatch(".-/") do - i = i + #d - end - gfs.mkdir(id:sub(1, i - 1)) - f = assert(io.open(id, "w")) - end + assert(gfs.make_parent_directories(id)) + local f = assert(io.open(id, "w")) for i = 1, math.min(#data.history[id].table, data.history[id].max) do f:write(data.history[id].table[i] .. "\n") end