mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 11:28:59 +00:00
Expand ~/ on Windows as well
This commit is contained in:
parent
ed07fc0f2c
commit
8661afcb4f
@ -244,7 +244,7 @@ func restGetSystem(w http.ResponseWriter) {
|
|||||||
res["goroutines"] = runtime.NumGoroutine()
|
res["goroutines"] = runtime.NumGoroutine()
|
||||||
res["alloc"] = m.Alloc
|
res["alloc"] = m.Alloc
|
||||||
res["sys"] = m.Sys
|
res["sys"] = m.Sys
|
||||||
res["tilde"] = expandTilde("~/")
|
res["tilde"] = expandTilde("~")
|
||||||
if cfg.Options.GlobalAnnEnabled && discoverer != nil {
|
if cfg.Options.GlobalAnnEnabled && discoverer != nil {
|
||||||
res["extAnnounceOK"] = discoverer.ExtAnnounceOK()
|
res["extAnnounceOK"] = discoverer.ExtAnnounceOK()
|
||||||
}
|
}
|
||||||
|
@ -679,7 +679,11 @@ func getDefaultConfDir() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func expandTilde(p string) 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
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user