1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-12-20 19:09:07 +01:00

Use OS-independent paths for the abs method

This commit is contained in:
Juan Font Alonso 2021-05-18 23:33:08 +02:00
parent 460a23cf2b
commit 5a42bace67

View File

@ -22,10 +22,10 @@ type ErrorOutput struct {
func absPath(path string) string {
// If a relative path is provided, prefix it with the the directory where
// the config file was found.
if (path != "") && !strings.HasPrefix(path, "/") {
if (path != "") && !strings.HasPrefix(path, string(os.PathSeparator)) {
dir, _ := filepath.Split(viper.ConfigFileUsed())
if dir != "" {
path = dir + "/" + path
path = filepath.Join(dir, path)
}
}
return path