feat: virtual path

This commit is contained in:
Xhofe
2022-03-31 20:43:17 +08:00
parent a0f4383d41
commit ced61da33a
10 changed files with 204 additions and 134 deletions

View File

@ -50,17 +50,18 @@ func (fs *FileSystem) File(rawPath string) (*model.File, error) {
func (fs *FileSystem) Files(ctx context.Context, rawPath string) ([]model.File, error) {
rawPath = utils.ParsePath(rawPath)
var files []model.File
var err error
if model.AccountsCount() > 1 && rawPath == "/" {
files, err = model.GetAccountFiles()
} else {
account, path_, driver, err := common.ParsePath(rawPath)
if err != nil {
return nil, err
}
files, err = operate.Files(driver, account, path_)
}
//var files []model.File
//var err error
//if model.AccountsCount() > 1 && rawPath == "/" {
// files, err = model.GetAccountFilesByPath("/")
//} else {
// account, path_, driver, err := common.ParsePath(rawPath)
// if err != nil {
// return nil, err
// }
// files, err = operate.Files(driver, account, path_)
//}
_, files, _, _, _, err := common.Path(rawPath)
if err != nil {
return nil, err
}