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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-04-02 18:54:08 +02:00
parent b4b070785f
commit 4bbedebea4
1 changed files with 2 additions and 9 deletions

View File

@ -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