mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
🎨 Supports local shorthands on Android https://github.com/siyuan-note/siyuan/issues/14414
This commit is contained in:
parent
33ed82526c
commit
f2654be837
1 changed files with 20 additions and 1 deletions
|
|
@ -41,9 +41,28 @@ func MoveLocalShorthands(boxID, hPath, parentID, id string) (retID string, err e
|
|||
|
||||
buff := bytes.Buffer{}
|
||||
var toRemoves []string
|
||||
assetsDir := filepath.Join(util.DataDir, "assets")
|
||||
for _, entry := range entries {
|
||||
if entry.IsDir() {
|
||||
continue
|
||||
if "assets" == entry.Name() {
|
||||
assetsEntries, readErr := os.ReadDir(filepath.Join(shorthandsDir, entry.Name()))
|
||||
if nil != readErr {
|
||||
logging.LogErrorf("read dir [%s] failed: %s", shorthandsDir, readErr)
|
||||
continue
|
||||
}
|
||||
for _, assetEntry := range assetsEntries {
|
||||
if assetEntry.IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
p := filepath.Join(shorthandsDir, entry.Name(), assetEntry.Name())
|
||||
assetWritePath := filepath.Join(assetsDir, assetEntry.Name())
|
||||
if renameErr := os.Rename(p, assetWritePath); nil != renameErr {
|
||||
logging.LogErrorf("rename file [%s] to [%s] failed: %s", p, assetWritePath, renameErr)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if filepath.Ext(entry.Name()) != ".md" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue