Exemplo n.º 1
0
func globGetFilesFromFilelist(filename string) ([]string, error) {
	fl, err := os.Open(filename)
	if err != nil {
		return nil, fmt.Errorf("Failed to open filelist %q: %v", filename, err)
	}
	defer fl.Close()
	lists := filelist.Lists{}
	if err := lists.ParseFilelist(fl); err != nil {
		return nil, err
	}
	return lists.Files, nil
}
Exemplo n.º 2
0
Arquivo: main.go Projeto: matomesc/rkt
func categorizeEntry(path string, mode os.FileMode, list *filelist.Lists) error {
	switch {
	case mode.IsDir():
		list.Dirs = append(list.Dirs, path)
	case mode.IsRegular():
		list.Files = append(list.Files, path)
	case isSymlink(mode):
		list.Symlinks = append(list.Symlinks, path)
	default:
		return fmt.Errorf("unsupported file mode: %d (not a file, directory or symlink)", mode&os.ModeType)
	}
	return nil
}