From 72b05cfc36a42d1ae0dcf284277bac2828cb4545 Mon Sep 17 00:00:00 2001 From: Dominik Richter Date: Thu, 21 Sep 2023 21:11:33 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20move=20default=20provider=20path?= =?UTF-8?q?=20on=20macos=20to=20/Library/Mondoo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add special handling for MacOS / Darwin and make sure all configs + providers are in the same shared directory `/Library/Mondoo` Signed-off-by: Dominik Richter --- cli/config/path.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cli/config/path.go b/cli/config/path.go index 8b1d1db1d3..d48ddf6649 100644 --- a/cli/config/path.go +++ b/cli/config/path.go @@ -83,10 +83,18 @@ func systemPath(isConfig bool, childPath ...string) string { var parts []string if runtime.GOOS == "windows" { parts = append([]string{`C:\ProgramData\Mondoo\`}, childPath...) - } else if isConfig { - parts = append([]string{"/etc", "opt", "mondoo"}, childPath...) + } else if runtime.GOOS == "darwin" { + if isConfig { + parts = append([]string{"/Library", "Mondoo", "etc"}, childPath...) + } else { + parts = append([]string{"/Library", "Mondoo"}, childPath...) + } } else { - parts = append([]string{"/opt", "mondoo"}, childPath...) + if isConfig { + parts = append([]string{"/etc", "opt", "mondoo"}, childPath...) + } else { + parts = append([]string{"/opt", "mondoo"}, childPath...) + } } systemConfig := filepath.Join(parts...)