From a423506252312b2affff59334d36ad6c5471d013 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 29 Aug 2019 16:16:48 -0600 Subject: version: hard code name and version at compile time We really do want the true name and version in logs so that external consumers have a good reference point for helping us debug. We can then do the log file directory explicitly. --- conf/path_windows.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'conf') diff --git a/conf/path_windows.go b/conf/path_windows.go index 041afe84..2997114e 100644 --- a/conf/path_windows.go +++ b/conf/path_windows.go @@ -10,8 +10,6 @@ import ( "path/filepath" "golang.org/x/sys/windows" - - "golang.zx2c4.com/wireguard/windows/version" ) var cachedConfigFileDir string @@ -35,6 +33,13 @@ func tunnelConfigurationsDirectory() (string, error) { return cachedConfigFileDir, nil } +// PresetRootDirectory causes RootDirectory() to not try any automatic deduction, and instead +// uses what's passed to it. This isn't used by wireguard-windows, but is useful for external +// consumers of our libraries who might want to do strange things. +func PresetRootDirectory(root string) { + cachedRootDir = root +} + func RootDirectory() (string, error) { if cachedRootDir != "" { return cachedRootDir, nil @@ -43,8 +48,7 @@ func RootDirectory() (string, error) { if err != nil { return "", err } - name, _ := version.RunningNameVersion() - c := filepath.Join(root, name) + c := filepath.Join(root, "WireGuard") err = os.MkdirAll(c, os.ModeDir|0700) if err != nil { return "", err -- cgit v1.2.3-59-g8ed1b