feat(fs): list files
This commit is contained in:
@ -7,7 +7,6 @@ import (
|
||||
"github.com/alist-org/alist/v3/internal/store"
|
||||
"github.com/alist-org/alist/v3/pkg/utils"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -132,10 +131,10 @@ func GetAccountsByPath(path string) []driver.Driver {
|
||||
return accounts
|
||||
}
|
||||
|
||||
// GetAccountFilesByPath Obtain the virtual file generated by the account according to the path
|
||||
// GetAccountVirtualFilesByPath Obtain the virtual file generated by the account according to the path
|
||||
// for example, there are: /a/b,/a/c,/a/d/e,/a/b.balance1,/av
|
||||
// GetAccountFilesByPath(/a) => b,c,d
|
||||
func GetAccountFilesByPath(prefix string) []driver.FileInfo {
|
||||
// GetAccountVirtualFilesByPath(/a) => b,c,d
|
||||
func GetAccountVirtualFilesByPath(prefix string) []driver.FileInfo {
|
||||
files := make([]driver.FileInfo, 0)
|
||||
accounts := make([]driver.Driver, len(accountsMap))
|
||||
i := 0
|
||||
@ -156,7 +155,7 @@ func GetAccountFilesByPath(prefix string) []driver.FileInfo {
|
||||
if utils.IsBalance(v.GetAccount().VirtualPath) {
|
||||
continue
|
||||
}
|
||||
full := utils.StandardizationPath(v.GetAccount().VirtualPath)
|
||||
full := v.GetAccount().VirtualPath
|
||||
if len(full) <= len(prefix) {
|
||||
continue
|
||||
}
|
||||
@ -164,7 +163,7 @@ func GetAccountFilesByPath(prefix string) []driver.FileInfo {
|
||||
if !strings.HasPrefix(full, prefix+"/") && prefix != "/" {
|
||||
continue
|
||||
}
|
||||
name := strings.Split(strings.TrimPrefix(strings.TrimPrefix(full, prefix), "/"), "/")[0]
|
||||
name := strings.Split(strings.TrimPrefix(full, prefix), "/")[0]
|
||||
if _, ok := set[name]; ok {
|
||||
continue
|
||||
}
|
||||
@ -201,7 +200,6 @@ func GetBalancedAccount(path string) driver.Driver {
|
||||
} else {
|
||||
balanceMap.Store(virtualPath, i)
|
||||
}
|
||||
log.Debugln("use: ", i)
|
||||
return accounts[i]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user