From c58516cfb00f22bf7271d28454d79c57dfd58ef0 Mon Sep 17 00:00:00 2001 From: Connie Lukawski Date: Sat, 23 Sep 2023 16:06:10 +0000 Subject: [PATCH] Fix windows config/socket dir location RMM uses non-user account which results in config + socket file being written to a random directory, which is not a real directory that can be accessed. Fix this by using directory of ctrld binary as user home dir. --- cmd/cli/cli.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/cli/cli.go b/cmd/cli/cli.go index afa5712..f548adc 100644 --- a/cmd/cli/cli.go +++ b/cmd/cli/cli.go @@ -1309,7 +1309,13 @@ func userHomeDir() (string, error) { } // viper will expand for us. if runtime.GOOS == "windows" { - return os.UserHomeDir() + // If we're on windows, use the install path for this. + exePath, err := os.Executable() + if err != nil { + return "", err + } + + return filepath.Dir(exePath), nil } // Mobile platform should provide a rw dir path for this. if isMobile() {