示例#1
0
文件: main.go 项目: 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
}