fsutils

package module
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

README

fsutils

My Go file systems library (for Linux at the moment).

TODO:

  • Cross Platform implementation
  • Re-create the API

License

Apache v2.0 license

Documentation

Index

Constants

View Source
const (
	// IRUSR Read by owner
	IRUSR = 00400
	// IREAD Read by owner
	IREAD = 00400
	// IWUSR Write by owner
	IWUSR = 00200
	// IWRITE Write by Owner
	IWRITE = 00200
	// IXUSR Execute/search by owner
	IXUSR = 00100
	// IEXEC Execute/search by owner
	IEXEC = 00100
	// IRGRP Read by group
	IRGRP = 00040
	// IWGRP Write by group
	IWGRP = 00020
	// IXGRP Execute/search by group
	IXGRP = 00010
	// IROTH Read by others
	IROTH = 00004
	// IWOTH Write by others
	IWOTH = 00002
	// IXOTH Execute/search by others
	IXOTH = 00001
)

Variables

This section is empty.

Functions

func GetCurrentDir

func GetCurrentDir(endseperator bool) string

GetCurrentDir returns the working directory that the executable points to

Types

type SystemPath

type SystemPath struct {
	// contains filtered or unexported fields
}

SystemPath represents a struct with private members that stores information about a path

func SystemInit

func SystemInit(path string) SystemPath

SystemInit get a path and create a SystemPath with it

func (SystemPath) Error

func (s SystemPath) Error() error

func (SystemPath) GetGID

func (s SystemPath) GetGID() (uint32, error)

GetGID returns the path group id or an error

func (SystemPath) GetUID

func (s SystemPath) GetUID() (uint32, error)

GetUID returns the path user id or an error

func (SystemPath) HasSetGid

func (s SystemPath) HasSetGid() bool

HasSetGid validate if a path contain a set gid property

func (SystemPath) HasSetUID

func (s SystemPath) HasSetUID() bool

HasSetUID valiate if a path contain a suid property

func (SystemPath) HaveError

func (s SystemPath) HaveError() bool

HaveError check to see if an error was returned

func (SystemPath) HavePerm

func (s SystemPath) HavePerm(perm os.FileMode) bool

HavePerm check to see if a permission exists in the path

func (SystemPath) IsAppend

func (s SystemPath) IsAppend() bool

IsAppend check if the path is opened for appending text

func (SystemPath) IsCharDevice

func (s SystemPath) IsCharDevice() bool

IsCharDevice validate if the path is a char file

func (SystemPath) IsDevice

func (s SystemPath) IsDevice() bool

IsDevice validate if the path is a type of device file

func (SystemPath) IsDir

func (s SystemPath) IsDir() bool

IsDir check if a path is actually a directory

func (SystemPath) IsExclusive

func (s SystemPath) IsExclusive() bool

IsExclusive validate if the path is opened exclusivly or not

func (SystemPath) IsExecutible

func (s SystemPath) IsExecutible() bool

IsExecutible check if a path have execution permission for the user

func (SystemPath) IsExist

func (s SystemPath) IsExist() bool

IsExist validate if a path actually exists

func (SystemPath) IsGroupExecutable

func (s SystemPath) IsGroupExecutable() bool

IsGroupExecutable validate if the path is executable by the group

func (SystemPath) IsGroupReadable

func (s SystemPath) IsGroupReadable() bool

IsGroupReadable validate if a path is readable by the group

func (SystemPath) IsGroupWriteable

func (s SystemPath) IsGroupWriteable() bool

IsGroupWriteable validate if the path is writeable by the group

func (SystemPath) IsNamedPipe

func (s SystemPath) IsNamedPipe() bool

IsNamedPipe validate if the path is a pipe file

func (SystemPath) IsOtherExecutable

func (s SystemPath) IsOtherExecutable() bool

IsOtherExecutable validate if the path is executable by others

func (SystemPath) IsOtherReadable

func (s SystemPath) IsOtherReadable() bool

IsOtherReadable validate if the path is readable by others

func (SystemPath) IsOtherWriteable

func (s SystemPath) IsOtherWriteable() bool

IsOtherWriteable validate if the path is writeable by others

func (SystemPath) IsOwnerExecutable

func (s SystemPath) IsOwnerExecutable() bool

IsOwnerExecutable validate if a path is executable by the owner

func (SystemPath) IsOwnerReadable

func (s SystemPath) IsOwnerReadable() bool

IsOwnerReadable validate if a path is readable by the owner

func (SystemPath) IsOwnerWriteable

func (s SystemPath) IsOwnerWriteable() bool

IsOwnerWriteable validate if a path is writeable by the owner

func (SystemPath) IsReadable

func (s SystemPath) IsReadable() bool

IsReadable check if the current user has read permission to a path

func (SystemPath) IsRegularFile

func (s SystemPath) IsRegularFile() bool

IsRegularFile validate if the path is not something special

func (SystemPath) IsSocket

func (s SystemPath) IsSocket() bool

IsSocket validate if the path is a socket file

func (SystemPath) IsStat

func (s SystemPath) IsStat(istat os.FileMode) bool

IsStat validate if a stat exists in the path

func (SystemPath) IsSticky

func (s SystemPath) IsSticky() bool

IsSticky validate if a path has a sticky property

func (s SystemPath) IsSymlink() bool

IsSymlink validate if a path is a symbolic link

func (SystemPath) IsTemporary

func (s SystemPath) IsTemporary() bool

IsTemporary validate if the path is set temporarly

func (SystemPath) IsWriteable

func (s SystemPath) IsWriteable() bool

IsWriteable check if the current user have write permission to a path

func (SystemPath) Size

func (s SystemPath) Size() int64

Size return length in bytes for regular files; system-dependent for others

type UserDetails

type UserDetails struct {
	// contains filtered or unexported fields
}

UserDetails contains private members regarding the current user in the system

func InitUser

func InitUser() UserDetails

InitUser get The current active user

  • If the user was not found, or something went wrong, we will return error and empty UserDetails.

func (UserDetails) GetEGid

func (u UserDetails) GetEGid() int

GetEGid retrive the effective group id

func (UserDetails) GetEUid

func (u UserDetails) GetEUid() int

GetEUid retrive the effective user id

func (UserDetails) GetGID

func (u UserDetails) GetGID() int

GetGID retrive the user's goup id

func (UserDetails) GetUID

func (u UserDetails) GetUID() int

GetUID retrive the user's id

Jump to

Keyboard shortcuts

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