mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 15:58:49 +01:00
🎨 搜索资源文件支持跟随 assets 文件夹符号链接 Fix https://github.com/siyuan-note/siyuan/issues/6217
This commit is contained in:
parent
a00e25cd1e
commit
56128b9cb7
3 changed files with 22 additions and 28 deletions
|
|
@ -632,11 +632,7 @@ func UnusedAssets() (ret []string) {
|
|||
delete(assetsPathMap, toRemove)
|
||||
}
|
||||
|
||||
dataAssetsAbsPath, err := getDataAssetsAbsPath()
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
dataAssetsAbsPath := util.GetDataAssetsAbsPath()
|
||||
for _, assetAbsPath := range assetsPathMap {
|
||||
if _, ok := linkDestMap[assetAbsPath]; ok {
|
||||
continue
|
||||
|
|
@ -794,10 +790,7 @@ func allAssetAbsPaths() (assetsAbsPathMap map[string]string, err error) {
|
|||
}
|
||||
|
||||
// 全局 assets
|
||||
dataAssetsAbsPath, err := getDataAssetsAbsPath()
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
dataAssetsAbsPath := util.GetDataAssetsAbsPath()
|
||||
filepath.Walk(dataAssetsAbsPath, func(assetPath string, info fs.FileInfo, err error) error {
|
||||
if dataAssetsAbsPath == assetPath {
|
||||
return nil
|
||||
|
|
@ -863,20 +856,3 @@ func copyAssetsToDataAssets(rootPath string) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getDataAssetsAbsPath() (ret string, err error) {
|
||||
ret = filepath.Join(util.DataDir, "assets")
|
||||
stat, statErr := os.Lstat(ret)
|
||||
if nil != statErr {
|
||||
err = statErr
|
||||
return
|
||||
}
|
||||
if 0 != stat.Mode()&os.ModeSymlink {
|
||||
// 跟随符号链接 https://github.com/siyuan-note/siyuan/issues/5480
|
||||
ret, err = os.Readlink(ret)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue