diff options
Diffstat (limited to 'conf/path_windows.go')
-rw-r--r-- | conf/path_windows.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/conf/path_windows.go b/conf/path_windows.go index e9ff783a..0ff0a057 100644 --- a/conf/path_windows.go +++ b/conf/path_windows.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package conf @@ -15,8 +15,10 @@ import ( "golang.org/x/sys/windows" ) -var cachedConfigFileDir string -var cachedRootDir string +var ( + cachedConfigFileDir string + cachedRootDir string +) func tunnelConfigurationsDirectory() (string, error) { if cachedConfigFileDir != "" { @@ -27,7 +29,7 @@ func tunnelConfigurationsDirectory() (string, error) { return "", err } c := filepath.Join(root, "Configurations") - err = os.Mkdir(c, os.ModeDir|0700) + err = os.Mkdir(c, os.ModeDir|0o700) if err != nil && !os.IsExist(err) { return "", err } @@ -126,3 +128,11 @@ func RootDirectory(create bool) (string, error) { cachedRootDir = data return cachedRootDir, nil } + +func LogFile(createRoot bool) (string, error) { + root, err := RootDirectory(createRoot) + if err != nil { + return "", err + } + return filepath.Join(root, "log.bin"), nil +} |