diff options
-rw-r--r-- | src/luarocks/core/cfg.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index 399912d5..9859c6b3 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua | |||
@@ -47,7 +47,7 @@ local platform_order = { | |||
47 | "mingw32", | 47 | "mingw32", |
48 | } | 48 | } |
49 | 49 | ||
50 | local function detect_sysconfdir(lua_version) | 50 | local function detect_sysconfdir() |
51 | local src = debug.getinfo(1, "S").source:gsub("\\", "/"):gsub("/+", "/") | 51 | local src = debug.getinfo(1, "S").source:gsub("\\", "/"):gsub("/+", "/") |
52 | if src:sub(1, 1) == "@" then | 52 | if src:sub(1, 1) == "@" then |
53 | src = src:sub(2) | 53 | src = src:sub(2) |
@@ -57,7 +57,7 @@ local function detect_sysconfdir(lua_version) | |||
57 | return | 57 | return |
58 | end | 58 | end |
59 | -- If installed in a Unix-like tree, use a Unix-like sysconfdir | 59 | -- If installed in a Unix-like tree, use a Unix-like sysconfdir |
60 | local installdir = basedir:match("^(.*)/share/lua/" .. lua_version .. "$") | 60 | local installdir = basedir:match("^(.*)/share/lua/[^/]*$") |
61 | if installdir then | 61 | if installdir then |
62 | if installdir == "/usr" then | 62 | if installdir == "/usr" then |
63 | return "/etc/luarocks" | 63 | return "/etc/luarocks" |
@@ -77,7 +77,7 @@ local function set_confdirs(cfg, platforms, hardcoded_sysconfdir) | |||
77 | cfg.sysconfdir = sysconfdir or ((os.getenv("PROGRAMFILES") or "c:") .. "/luarocks") | 77 | cfg.sysconfdir = sysconfdir or ((os.getenv("PROGRAMFILES") or "c:") .. "/luarocks") |
78 | else | 78 | else |
79 | if not sysconfdir then | 79 | if not sysconfdir then |
80 | sysconfdir = detect_sysconfdir(cfg.lua_version) | 80 | sysconfdir = detect_sysconfdir() |
81 | end | 81 | end |
82 | cfg.home = os.getenv("HOME") or "" | 82 | cfg.home = os.getenv("HOME") or "" |
83 | cfg.home_tree = (os.getenv("USER") ~= "root") and cfg.home.."/.luarocks" | 83 | cfg.home_tree = (os.getenv("USER") ~= "root") and cfg.home.."/.luarocks" |