aboutsummaryrefslogtreecommitdiffstats
path: root/test/lua
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-04-26 17:36:58 +0200
committerPeter Wu <peter@lekensteyn.nl>2018-04-30 10:33:46 +0000
commitb9f915eeefc4e2db1f151cd5bd2f808711532b1c (patch)
tree484b22dec9e3013d2ecf3db0ffc336598888cc70 /test/lua
parentd8ba341856fcc2305e876a9f67430ca63d03ad01 (diff)
Lua: ensure that DATA_DIR and USER_DIR have trailing slashes
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 <j@v6e.pt> Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'test/lua')
-rw-r--r--test/lua/dir.lua5
1 files changed, 5 insertions, 0 deletions
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__ .. "'")