dirutil

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package dirutil contains directory manipulation helpers.

Index

Constants

This section is empty.

Variables

View Source
var ErrTopLevelDirectoryNotFound = errors.New("top-level directory not found")

ErrTopLevelDirectoryNotFound is returned by MkSubdir if the top-level directory is not found.

Functions

func MkSubdirAll

func MkSubdirAll(osi OSInterface, topLevelDir, subDir string, perm fs.FileMode) error

MkSubdirAll is like os.MkdirAll(subDir, perm) but will only create missing subdirectories of topLevelDir (but not topLevelDir itself). If a top-level directory is unmounted, we want to avoid recreating it, which is what os.MkdirAll() does.

Types

type OSInterface

type OSInterface interface {
	Mkdir(dirname string, perm fs.FileMode) error
	IsExist(err error) bool
	IsNotExist(err error) bool
	IsPathSeparator(s byte) bool
}

OSInterface represents operating system functions used by MkSubdirAll.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL