From 2f63c2b0c9584aced8578bdb8723eef3e0a4157c Mon Sep 17 00:00:00 2001 From: Carl Smedstad Date: Mon, 5 Apr 2021 01:02:26 +0200 Subject: Simplify the code in set_confdirs --- src/luarocks/core/cfg.lua | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index b2b26fad..3c672693 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua @@ -72,23 +72,16 @@ end local function set_confdirs(cfg, platforms, hardcoded_sysconfdir) local sysconfdir = os.getenv("LUAROCKS_SYSCONFDIR") or hardcoded_sysconfdir - local windows_style = platforms.windows - if platforms.msys2_mingw_w64 then - windows_style = false - end - if windows_style then + if platforms.windows and not platforms.msys2_mingw_w64 then cfg.home = os.getenv("APPDATA") or "c:" cfg.home_tree = cfg.home.."/luarocks" cfg.homeconfdir = cfg.home_tree cfg.sysconfdir = sysconfdir or ((os.getenv("PROGRAMFILES") or "c:") .. "/luarocks") else - if not sysconfdir then - sysconfdir = detect_sysconfdir() - end cfg.home = os.getenv("HOME") or "" cfg.home_tree = cfg.home.."/.luarocks" cfg.homeconfdir = cfg.home_tree - cfg.sysconfdir = sysconfdir or "/etc/luarocks" + cfg.sysconfdir = sysconfdir or detect_sysconfdir() or "/etc/luarocks" end end -- cgit v1.2.3-55-g6feb