From 128c1ec32fe3d19d49c9fc80624283d437f4f71c Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 11 Mar 2018 16:04:27 +0100 Subject: [PATCH 1/4] Fix the reference to the default config in my-first-awesome The line in the default config changed at some point. Signed-off-by: Uli Schlachter --- docs/07-my-first-awesome.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/07-my-first-awesome.md b/docs/07-my-first-awesome.md index 848bf5c9..d7e2de44 100644 --- a/docs/07-my-first-awesome.md +++ b/docs/07-my-first-awesome.md @@ -71,7 +71,7 @@ Awesome has four themes you can choose from: *default*, *sky*, *xresources*, and To change the theme, open your rc.lua and edit this line near the beginning of the file: - beautiful.init(gears.filesystem.get_dir("config") .. "/themes/default/theme.lua") + beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") For this tutorial we will stick with the default theme. From 3e7ab86fae8c7e9a52560db779e5bd0ff3d3bd5d Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 11 Mar 2018 16:05:52 +0100 Subject: [PATCH 2/4] sample_theme: Use get_configuration_dir() Signed-off-by: Uli Schlachter --- docs/sample_theme.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sample_theme.lua b/docs/sample_theme.lua index a61a1542..5aa32134 100644 --- a/docs/sample_theme.lua +++ b/docs/sample_theme.lua @@ -19,7 +19,7 @@ require("sample_files")( -- -- with -- --- beautiful.init(gears.filesystem.get_dir("config") .. "mytheme.lua") +-- beautiful.init(gears.filesystem.get_configuration_dir() .. "mytheme.lua") -- -- in your `rc.lua`. -- From c8d6b7d28ab68889b0f1128f1d95ac770cc18475 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 11 Mar 2018 16:07:36 +0100 Subject: [PATCH 3/4] Use get_cache_dir() where appropriate Signed-off-by: Uli Schlachter --- lib/menubar/init.lua | 4 ++-- tests/examples/wibox/awidget/prompt/hooks.lua | 2 +- tests/examples/wibox/awidget/prompt/keypress.lua | 2 +- tests/examples/wibox/awidget/prompt/vilike.lua | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/menubar/init.lua b/lib/menubar/init.lua index 776adea1..8252baeb 100644 --- a/lib/menubar/init.lua +++ b/lib/menubar/init.lua @@ -130,7 +130,7 @@ local function load_count_table() return instance.count_table end instance.count_table = {} - local count_file_name = gfs.get_dir("cache") .. "/menu_count_file" + local count_file_name = gfs.get_cache_dir() .. "/menu_count_file" local count_file = io.open (count_file_name, "r") if count_file then for line in count_file:lines() do @@ -146,7 +146,7 @@ end local function write_count_table(count_table) count_table = count_table or instance.count_table - local count_file_name = gfs.get_dir("cache") .. "/menu_count_file" + local count_file_name = gfs.get_cache_dir() .. "/menu_count_file" local count_file = assert(io.open(count_file_name, "w")) for name, count in pairs(count_table) do local str = string.format("%s;%d\n", name, count) diff --git a/tests/examples/wibox/awidget/prompt/hooks.lua b/tests/examples/wibox/awidget/prompt/hooks.lua index 90fefe96..70940681 100644 --- a/tests/examples/wibox/awidget/prompt/hooks.lua +++ b/tests/examples/wibox/awidget/prompt/hooks.lua @@ -54,7 +54,7 @@ local gfs = require("gears.filesystem") --DOC_HIDE prompt = "Run: ", hooks = hooks, textbox = atextbox, - history_path = gfs.get_dir("cache") .. "/history", + history_path = gfs.get_cache_dir() .. "/history", done_callback = clear, } diff --git a/tests/examples/wibox/awidget/prompt/keypress.lua b/tests/examples/wibox/awidget/prompt/keypress.lua index 5264e7fd..26a105d2 100644 --- a/tests/examples/wibox/awidget/prompt/keypress.lua +++ b/tests/examples/wibox/awidget/prompt/keypress.lua @@ -24,7 +24,7 @@ local naughty = {} --DOC_HIDE end end, textbox = atextbox, - history_path = gfs.get_dir("cache") .. "/history", + history_path = gfs.get_cache_dir() .. "/history", } parent:add( wibox.widget { --DOC_HIDE diff --git a/tests/examples/wibox/awidget/prompt/vilike.lua b/tests/examples/wibox/awidget/prompt/vilike.lua index 8d45296b..445d74f5 100644 --- a/tests/examples/wibox/awidget/prompt/vilike.lua +++ b/tests/examples/wibox/awidget/prompt/vilike.lua @@ -44,7 +44,7 @@ local terminal = "xterm" --DOC_HIDE end}, }, textbox = atextbox, - history_path = gfs.get_dir('cache') .. '/history', + history_path = gfs.get_cache_dir() .. '/history', exe_callback = function(cmd) awful.spawn(cmd) end } From 675900407a770f12d268e8cc50ced6b4ddc849e6 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 11 Mar 2018 15:58:04 +0100 Subject: [PATCH 4/4] Deprecate gears.filesystem.get_dir It is a useless thin wrapper around other functions. It's better to use these other functions directly. Signed-off-by: Uli Schlachter --- lib/gears/filesystem.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/gears/filesystem.lua b/lib/gears/filesystem.lua index 55d068eb..b9c84056 100644 --- a/lib/gears/filesystem.lua +++ b/lib/gears/filesystem.lua @@ -145,8 +145,10 @@ function filesystem.get_dir(d) if d == "config" then -- No idea why this is what is returned, I recommend everyone to use -- get_configuration_dir() instead + require("gears.debug").deprecate("gears.filesystem.get_xdg_config_home() .. 'awesome/'", {deprecated_in=5}) return filesystem.get_xdg_config_home() .. "awesome/" elseif d == "cache" then + require("gears.debug").deprecate("gears.filesystem.get_cache_dir", {deprecated_in=5}) return filesystem.get_cache_dir() end end