change path interface

This commit is contained in:
微凉
2021-11-23 15:58:03 +08:00
parent e31402e94f
commit 163ee1159e
9 changed files with 32 additions and 32 deletions

View File

@ -52,14 +52,14 @@ func (n Native) Save(account *model.Account, old *model.Account) error {
}
// TODO sort files
func (n Native) Path(path string, account *model.Account) (*model.File, []*model.File, error) {
func (n Native) Path(path string, account *model.Account) (*model.File, []model.File, error) {
fullPath := filepath.Join(account.RootFolder, path)
log.Debugf("%s-%s-%s", account.RootFolder, path, fullPath)
if !utils.Exists(fullPath) {
return nil, nil, fmt.Errorf("path not found")
}
if utils.IsDir(fullPath) {
result := make([]*model.File, 0)
result := make([]model.File, 0)
files, err := ioutil.ReadDir(fullPath)
if err != nil {
return nil, nil, err
@ -69,7 +69,7 @@ func (n Native) Path(path string, account *model.Account) (*model.File, []*model
continue
}
time := f.ModTime()
file := &model.File{
file := model.File{
Name: f.Name(),
Size: f.Size(),
Type: 0,