filesystem

package
v0.1.16-ntpfix Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package filesystem provides functionality for interacting with directories and files in a cross-platform manner.

Index

Constants

View Source
const OwnerReadWrite = 0600

OwnerReadWrite is a standard owner read / write file permission.

View Source
const OwnerReadWriteExec = 0700

OwnerReadWriteExec is a standard owner read / write / exec file permission.

Variables

This section is empty.

Functions

func ExistOrCreate

func ExistOrCreate(path string) (err error)

ExistOrCreate creates the given path if it does not exist.

func GetCanonicalPath

func GetCanonicalPath(p string) string

GetCanonicalPath returns an os-specific full path following these rules: - replace ~ with user's home dir path - expand any ${vars} or $vars - resolve relative paths /.../ p: source path name

func GetFullDirectoryPath

func GetFullDirectoryPath(name string) (string, error)

GetFullDirectoryPath gets the OS specific full path for a named directory. The directory is created if it doesn't exist.

func GetUserHomeDirectory

func GetUserHomeDirectory() string

GetUserHomeDirectory returns the current user's home directory if one is set by the system.

func PathExists

func PathExists(path string) bool

PathExists returns true iff file exists in local store and is accessible.

func SetupTestHooks

func SetupTestHooks(users map[string]*user.User)

SetupTestHooks sets current user to mock user to test

func TearDownTestHooks

func TearDownTestHooks()

TearDownTestHooks sets current user back

func TestUsers

func TestUsers() map[string]*user.User

TestUsers returns a map of users for testing

Types

This section is empty.

Jump to

Keyboard shortcuts

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