aboutsummaryrefslogtreecommitdiffstats
path: root/conf
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-08-29 16:16:48 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2019-08-30 08:47:21 -0600
commita423506252312b2affff59334d36ad6c5471d013 (patch)
tree18badadf8bdf1b77b93932b947a352e5591ddf2b /conf
parentversion: use ProductName and ProductVersion as strings (diff)
downloadwireguard-windows-a423506252312b2affff59334d36ad6c5471d013.tar.xz
wireguard-windows-a423506252312b2affff59334d36ad6c5471d013.zip
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.
Diffstat (limited to 'conf')
-rw-r--r--conf/path_windows.go12
1 files changed, 8 insertions, 4 deletions
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