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:
parent
f1b78a6ff2
commit
4d0c9eb86e
|
@ -91,9 +91,9 @@ end
|
||||||
-- @return mkdir return code
|
-- @return mkdir return code
|
||||||
-- @see gears.filesystem
|
-- @see gears.filesystem
|
||||||
function util.mkdir(dir)
|
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
|
end
|
||||||
|
|
||||||
--- Eval Lua code.
|
--- Eval Lua code.
|
||||||
|
|
|
@ -23,13 +23,18 @@ local function make_directory(gfile)
|
||||||
return false, err
|
return false, err
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create a directory
|
--- Create a directory, including all missing parent directories.
|
||||||
-- @tparam string dir The directory.
|
-- @tparam string dir The directory.
|
||||||
-- @return (true, nil) on success, (false, err) on failure
|
-- @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))
|
return make_directory(Gio.File.new_for_path(dir))
|
||||||
end
|
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.
|
--- Create all parent directories for a given file.
|
||||||
-- @tparam string path The path whose parents should be created.
|
-- @tparam string path The path whose parents should be created.
|
||||||
-- @return (true, nil) on success, (false, err) on failure
|
-- @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.
|
-- @return A string with the requested path with a slash at the end.
|
||||||
function filesystem.get_cache_dir()
|
function filesystem.get_cache_dir()
|
||||||
local result = filesystem.get_xdg_cache_home() .. "awesome/"
|
local result = filesystem.get_xdg_cache_home() .. "awesome/"
|
||||||
filesystem.mkdir(result)
|
filesystem.make_directories(result)
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue