示例#1
0
文件: file.go 项目: logtcn/TMSU
// Retrieves all files that are under the specified directory.
func (store *Storage) FilesByDirectory(tx *Tx, path string) (entities.Files, error) {
	relPath := store.relPath(path)
	files, err := database.FilesByDirectory(tx.tx, relPath)
	store.absPaths(files)

	return files, err
}
示例#2
0
文件: file.go 项目: logtcn/TMSU
// Retrieves all file that are under the specified directories.
func (store *Storage) FilesByDirectories(tx *Tx, paths []string) (entities.Files, error) {
	files := make(entities.Files, 0, 100)

	for _, path := range paths {
		relPath := store.relPath(path)
		pathFiles, err := database.FilesByDirectory(tx.tx, relPath)
		if err != nil {
			return nil, fmt.Errorf("'%v': could not retrieve files for directory: %v", path, err)
		}

		files = append(files, pathFiles...)
	}

	store.absPaths(files)

	return files, nil
}