From b9f915eeefc4e2db1f151cd5bd2f808711532b1c Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 26 Apr 2018 17:36:58 +0200 Subject: Lua: ensure that DATA_DIR and USER_DIR have trailing slashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These directories have had trailing slashes for years and users seem to rely on it, so restore this assumption for backwards compatibility. The underlying API function (Dir.persconffile_path()) is not changed because trailing slashes were not documented for that function. For consistency, ensure that all Lua Dir functions return paths without trailing slashes. Bug: 14619 Change-Id: Ia299864999578884b1ad1cd48f1bd883bce6879d Fixes: v2.5.0rc0-579-gfb052a637f ("Use g_build_filename() instead, fix indentation") Reviewed-on: https://code.wireshark.org/review/27166 Reviewed-by: João Valverde Petri-Dish: João Valverde Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu --- test/lua/dir.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/lua') diff --git a/test/lua/dir.lua b/test/lua/dir.lua index 51ea84e5f0..d48364f460 100644 --- a/test/lua/dir.lua +++ b/test/lua/dir.lua @@ -71,6 +71,11 @@ test("Dir.global_config_path", pcall(callDirFuncBase, "global_config_path", t test("Dir.personal_plugins_path", pcall(callDirFuncBase, "personal_plugins_path", t)) test("Dir.global_plugins_path", pcall(callDirFuncBase, "global_plugins_path", t)) +-- Users expect trailing slashes for DATA_DIR and USER_DIR (bug 14619). +local dirsep = package.config:sub(1,1) +test("DATA_DIR", string.sub(DATA_DIR, -1) == dirsep) +test("USER_DIR", string.sub(USER_DIR, -1) == dirsep) + print("\nFor your information, I got the following info:\n") print("__FILE__ = '" .. __FILE__ .. "'") print("__DIR__ = '" .. __DIR__ .. "'") -- cgit v1.2.3