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
|
|
@ -101,6 +101,11 @@ func Icons() (icons []*Icon) {
|
|||
|
||||
func InstalledIcons() (ret []*Icon) {
|
||||
ret = []*Icon{}
|
||||
|
||||
if !util.IsPathRegularDirOrSymlinkDir(util.IconsPath) {
|
||||
return
|
||||
}
|
||||
|
||||
iconDirs, err := os.ReadDir(util.IconsPath)
|
||||
if nil != err {
|
||||
logging.LogWarnf("read icons folder failed: %s", err)
|
||||
|
|
@ -110,7 +115,7 @@ func InstalledIcons() (ret []*Icon) {
|
|||
bazaarIcons := Icons()
|
||||
|
||||
for _, iconDir := range iconDirs {
|
||||
if !iconDir.IsDir() {
|
||||
if !util.IsDirRegularOrSymlink(iconDir) {
|
||||
continue
|
||||
}
|
||||
dirName := iconDir.Name()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/dustin/go-humanize"
|
||||
ants "github.com/panjf2000/ants/v2"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
|
|
@ -106,7 +105,7 @@ func InstalledPlugins() (ret []*Plugin) {
|
|||
ret = []*Plugin{}
|
||||
|
||||
pluginsPath := filepath.Join(util.DataDir, "plugins")
|
||||
if !gulu.File.IsDir(pluginsPath) {
|
||||
if !util.IsPathRegularDirOrSymlinkDir(pluginsPath) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +118,7 @@ func InstalledPlugins() (ret []*Plugin) {
|
|||
bazaarPlugins := Plugins()
|
||||
|
||||
for _, pluginDir := range pluginDirs {
|
||||
if !pluginDir.IsDir() {
|
||||
if !util.IsDirRegularOrSymlink(pluginDir) {
|
||||
continue
|
||||
}
|
||||
dirName := pluginDir.Name()
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
|
|
@ -107,7 +106,7 @@ func InstalledTemplates() (ret []*Template) {
|
|||
ret = []*Template{}
|
||||
|
||||
templatesPath := filepath.Join(util.DataDir, "templates")
|
||||
if !gulu.File.IsDir(templatesPath) {
|
||||
if !util.IsPathRegularDirOrSymlinkDir(templatesPath) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +119,7 @@ func InstalledTemplates() (ret []*Template) {
|
|||
bazaarTemplates := Templates()
|
||||
|
||||
for _, templateDir := range templateDirs {
|
||||
if !templateDir.IsDir() {
|
||||
if !util.IsDirRegularOrSymlink(templateDir) {
|
||||
continue
|
||||
}
|
||||
dirName := templateDir.Name()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/dustin/go-humanize"
|
||||
ants "github.com/panjf2000/ants/v2"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
|
|
@ -105,7 +104,7 @@ func Themes() (ret []*Theme) {
|
|||
func InstalledThemes() (ret []*Theme) {
|
||||
ret = []*Theme{}
|
||||
|
||||
if !gulu.File.IsDir(util.ThemesPath) {
|
||||
if !util.IsPathRegularDirOrSymlinkDir(util.ThemesPath) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +117,7 @@ func InstalledThemes() (ret []*Theme) {
|
|||
bazaarThemes := Themes()
|
||||
|
||||
for _, themeDir := range themeDirs {
|
||||
if !themeDir.IsDir() {
|
||||
if !util.IsDirRegularOrSymlink(themeDir) {
|
||||
continue
|
||||
}
|
||||
dirName := themeDir.Name()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/dustin/go-humanize"
|
||||
ants "github.com/panjf2000/ants/v2"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
|
|
@ -105,7 +104,7 @@ func InstalledWidgets() (ret []*Widget) {
|
|||
ret = []*Widget{}
|
||||
|
||||
widgetsPath := filepath.Join(util.DataDir, "widgets")
|
||||
if !gulu.File.IsDir(widgetsPath) {
|
||||
if !util.IsPathRegularDirOrSymlinkDir(widgetsPath) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +117,7 @@ func InstalledWidgets() (ret []*Widget) {
|
|||
bazaarWidgets := Widgets()
|
||||
|
||||
for _, widgetDir := range widgetDirs {
|
||||
if !widgetDir.IsDir() {
|
||||
if !util.IsDirRegularOrSymlink(widgetDir) {
|
||||
continue
|
||||
}
|
||||
dirName := widgetDir.Name()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue