🎨 Support local file system sync & backup https://github.com/siyuan-note/siyuan/pull/13663

This commit is contained in:
Daniel 2024-12-31 23:24:52 +08:00
parent c9dc44efd1
commit 53185297a4
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -475,6 +475,26 @@ func SetSyncProviderLocal(local *conf.Local) (err error) {
local.Endpoint = strings.TrimSpace(local.Endpoint)
local.Endpoint = util.NormalizeLocalPath(local.Endpoint)
absPath, err := filepath.Abs(local.Endpoint)
if nil != err {
msg := fmt.Sprintf("get endpoint [%s] abs path failed: %s", local.Endpoint, err)
logging.LogErrorf(msg)
err = errors.New(fmt.Sprintf(Conf.Language(77), msg))
return
}
if !gulu.File.IsExist(absPath) {
msg := fmt.Sprintf("endpoint [%s] not exist", local.Endpoint+" ("+absPath+")")
logging.LogErrorf(msg)
err = errors.New(fmt.Sprintf(Conf.Language(77), msg))
return
}
if util.IsAbsPathInWorkspace(absPath) {
msg := fmt.Sprintf("endpoint [%s] is in workspace", local.Endpoint+" ("+absPath+")")
logging.LogErrorf(msg)
err = errors.New(fmt.Sprintf(Conf.Language(77), msg))
return
}
local.Timeout = util.NormalizeTimeout(local.Timeout)
local.ConcurrentReqs = util.NormalizeConcurrentReqs(local.ConcurrentReqs, conf.ProviderLocal)