diff options
author | Jakob Borg <jakob@nym.se> | 2014-05-24 13:22:09 +0200 |
---|---|---|
committer | Jakob Borg <jakob@nym.se> | 2014-05-24 13:34:40 +0200 |
commit | 8661afcb4f0cbbaf48d8236a49255182599ac2ca (patch) | |
tree | 1a2b897c9b634d083dcd93c93e2063a4f0685b96 /cmd | |
parent | ed07fc0f2c68d6e918ce2e14b92afe339f43ad93 (diff) |
Expand ~/ on Windows as well
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/syncthing/gui.go | 2 | ||||
-rw-r--r-- | cmd/syncthing/main.go | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index cf997588c5..1a9ca01251 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -244,7 +244,7 @@ func restGetSystem(w http.ResponseWriter) { res["goroutines"] = runtime.NumGoroutine() res["alloc"] = m.Alloc res["sys"] = m.Sys - res["tilde"] = expandTilde("~/") + res["tilde"] = expandTilde("~") if cfg.Options.GlobalAnnEnabled && discoverer != nil { res["extAnnounceOK"] = discoverer.ExtAnnounceOK() } diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 592275aefd..e02be4511c 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -679,7 +679,11 @@ func getDefaultConfDir() string { } func expandTilde(p string) string { - if runtime.GOOS == "windows" || !strings.HasPrefix(p, "~/") { + if p == "~" { + return getHomeDir() + } + + if !strings.HasPrefix(p, fmt.Sprintf("~%c", os.PathSeparator)) { return p } |