🎨 macOS 端对工作空间放置在 iCloud 路径下做检查 https://github.com/siyuan-note/siyuan/issues/7747

This commit is contained in:
Liang Ding 2023-03-22 19:44:28 +08:00
parent dae90dd912
commit 932ebc1ad9
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -267,6 +267,26 @@ func isICloudPath(absPath string) bool {
return err
}
if 0 != info.Mode()&os.ModeSymlink && 0 != info.Mode()&os.ModeDir {
resolved, symErr := filepath.EvalSymlinks(path)
if nil != symErr {
logging.LogErrorf("resolve symlink [%s] failed: %s", path, symErr)
return nil
}
filepath.Walk(resolved, func(path string, info os.FileInfo, err error) error {
if nil != err {
return err
}
if absPath == strings.ToLower(path) {
logging.LogInfof("under symlink path: %s", path)
return fmt.Errorf("found")
}
return nil
})
}
logging.LogInfof("path: %s", path)
return nil
})