mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
Bazaar resource directories support symlink (#8263)
* 🎨 bazaar resource directories support symlink * 🎨 bazaar resource directories support symlink
This commit is contained in:
parent
85496345ef
commit
fdbfe6b848
8 changed files with 38 additions and 19 deletions
|
|
@ -19,6 +19,7 @@ package util
|
|||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
|
@ -42,6 +43,23 @@ func IsEmptyDir(p string) bool {
|
|||
return 1 > len(files)
|
||||
}
|
||||
|
||||
func IsDirRegularOrSymlink(dir fs.DirEntry) bool {
|
||||
return dir.IsDir() || dir.Type() == fs.ModeSymlink
|
||||
}
|
||||
|
||||
func IsPathRegularDirOrSymlinkDir(path string) bool {
|
||||
fio, err := os.Stat(path)
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
|
||||
if nil != err {
|
||||
return false
|
||||
}
|
||||
|
||||
return fio.IsDir()
|
||||
}
|
||||
|
||||
func RemoveID(name string) string {
|
||||
ext := path.Ext(name)
|
||||
name = strings.TrimSuffix(name, ext)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue