mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-23 18:15:26 +00:00
Use OS-independent paths for the abs method
This commit is contained in:
parent
460a23cf2b
commit
5a42bace67
@ -22,10 +22,10 @@ type ErrorOutput struct {
|
|||||||
func absPath(path string) string {
|
func absPath(path string) string {
|
||||||
// If a relative path is provided, prefix it with the the directory where
|
// If a relative path is provided, prefix it with the the directory where
|
||||||
// the config file was found.
|
// the config file was found.
|
||||||
if (path != "") && !strings.HasPrefix(path, "/") {
|
if (path != "") && !strings.HasPrefix(path, string(os.PathSeparator)) {
|
||||||
dir, _ := filepath.Split(viper.ConfigFileUsed())
|
dir, _ := filepath.Split(viper.ConfigFileUsed())
|
||||||
if dir != "" {
|
if dir != "" {
|
||||||
path = dir + "/" + path
|
path = filepath.Join(dir, path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return path
|
return path
|
||||||
|
Loading…
Reference in New Issue
Block a user