Rename filesystem.mkdir to make_directories

The longer name is a bit more self-explanatory. The plural is meant to
indicate that this recursively creates missing parent directories and
does not just try to create the single given target directory.

Since filesystem.mkdir() is part of the v4.1 release, a deprecation stub
is needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-04-08 11:02:53 +02:00
parent f1b78a6ff2
commit 4d0c9eb86e
2 changed files with 10 additions and 5 deletions

View File

@ -91,9 +91,9 @@ end
-- @return mkdir return code
-- @see gears.filesystem
function util.mkdir(dir)
util.deprecate("gears.filesystem.mkdir", {deprecated_in=5})
util.deprecate("gears.filesystem.make_directories", {deprecated_in=5})
return gfs.mkdir(dir)
return gfs.make_directories(dir)
end
--- Eval Lua code.

View File

@ -23,13 +23,18 @@ local function make_directory(gfile)
return false, err
end
--- Create a directory
--- Create a directory, including all missing parent directories.
-- @tparam string dir The directory.
-- @return (true, nil) on success, (false, err) on failure
function filesystem.mkdir(dir)
function filesystem.make_directories(dir)
return make_directory(Gio.File.new_for_path(dir))
end
function filesystem.mkdir(dir)
require("gears.debug").deprecate("gears.filesystem.make_directories", {deprecated_in=5})
return filesystem.make_directories(dir)
end
--- Create all parent directories for a given file.
-- @tparam string path The path whose parents should be created.
-- @return (true, nil) on success, (false, err) on failure
@ -104,7 +109,7 @@ end
-- @return A string with the requested path with a slash at the end.
function filesystem.get_cache_dir()
local result = filesystem.get_xdg_cache_home() .. "awesome/"
filesystem.mkdir(result)
filesystem.make_directories(result)
return result
end