lib/versioner: Interpret versions path relative to folder path (fixes #4188)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4243
This commit is contained in:
Siyuan Liu 2017-07-03 14:50:51 +00:00 committed by Jakob Borg
parent b79f8aceb8
commit 03c678a810

View File

@ -51,11 +51,14 @@ func NewStaggered(folderID, folderPath string, params map[string]string) Version
// Use custom path if set, otherwise .stversions in folderPath
var versionsDir string
if params["versionsPath"] == "" {
l.Debugln("using default dir .stversions")
versionsDir = filepath.Join(folderPath, ".stversions")
} else {
l.Debugln("using default dir .stversions")
} else if filepath.IsAbs(params["versionsPath"]) {
l.Debugln("using dir", params["versionsPath"])
versionsDir = params["versionsPath"]
} else {
versionsDir = filepath.Join(folderPath, params["versionsPath"])
l.Debugln("using dir", versionsDir)
}
s := &Staggered{