Documentation ¶
Index ¶
- Constants
- func CleanUpFileOperation(file *os.File, returnError *error)
- func DeleteProgram(deleteProgramPath string) error
- func FileExists(filePath string) bool
- func FindPaths() (err error, evalErr error)
- func FolderExists(folderPath string) bool
- func GetBinaryPath() string
- func GetOSArch() string
- func GetPidCreateTime(pid int) (time int64, err error)
- func GetProcessCreateTime(proc *os.Process) (time int64, err error)
- func GetProgramPath() string
- func Is64BitOS() bool
- func IsDir(path string) bool
- func IsEmpty(filePath string) bool
- func IsPermission(err error) bool
- func IsPidRunning(pid int) bool
- func IsProcessSignatureRunning(procSig *ProcessSignature) bool
- func MatchesPlatform(platform string, os string, arch string) bool
- func MustCopyAll(src, dst string)
- func MustCopyFile(from, to string)
- func MustGetAbsolutePath(filePath string) string
- func MustMakeDir(dirPath string)
- func MustMakeTempDirectory(forFolderAtPath string) string
- func MustMoveAll(src, dst string)
- func MustMoveFiles(fromDirectory, toDirectory string)
- func MustPutFile(localFilePath string, bytes []byte)
- func MustReadFile(filePath string) []byte
- func MustRecursivelyRemoveEmptyFolders(folder string) bool
- func MustRemoveFile(filePath string)
- func ShowLocalFileInFileManager(path string) error
- func TryRemove(filePath string)
- func TryRemoveDirectory(path string)
- func TryRemoveEmpty(filePath string)
- func UndeployProgram(undeployProgramPath string) (string, error)
- type FileSystemError
- type ProcessSignature
Constants ¶
const ( OsWindows = "windows" OsMac = "darwin" OsLinux = "linux" Arch64 = "amd64" Arch32 = "386" )
Variables ¶
This section is empty.
Functions ¶
func CleanUpFileOperation ¶
func DeleteProgram ¶
DeleteProgram immediately deletes the binary or MacOS application bundle at deleteProgramPath, unless the operating system is Windows; in that case the file at deleteProgramPath will be deleted after 3 seconds.
func FileExists ¶
func FolderExists ¶
func GetBinaryPath ¶
func GetBinaryPath() string
GetBinaryPath returns the path where the binary of the calling program lies.
func GetOSArch ¶
func GetOSArch() string
Returns "amd64" if the underlying OS is 64 bit. Returns "386" otherwise. This is compliant with the GOARCH naming scheme. Do not confuse the result of this function with runtime.GOARCH, which describes the architecture this binary was built for instead.
func GetPidCreateTime ¶
func GetProcessCreateTime ¶
Reports the time at which the given process launched in some format, with at least millisecond precision.
func GetProgramPath ¶
func GetProgramPath() string
GetProgramPath returns the path where the calling program lies. This will be identical to the result of GetBinaryPath() unless the OS is MacOS, where GetProgramPath() will return the path of the program's application bundle folder.
func IsPermission ¶ added in v1.4.0
IsPermission returns true if err or any of its nested errors return true for os.IsPermission().
func IsPidRunning ¶
func IsProcessSignatureRunning ¶
func IsProcessSignatureRunning(procSig *ProcessSignature) bool
func MustCopyAll ¶
func MustCopyAll(src, dst string)
Copy the file or folder at src to dst. If dst is taken by an existing file or folder, it will be removed beforehand.
func MustCopyFile ¶
func MustCopyFile(from, to string)
func MustGetAbsolutePath ¶
func MustMakeDir ¶
func MustMakeDir(dirPath string)
func MustMakeTempDirectory ¶
func MustMoveAll ¶
func MustMoveAll(src, dst string)
Move the file or folder at src to dst. If dst is taken by an existing file or folder, it will be removed beforehand.
func MustMoveFiles ¶
func MustMoveFiles(fromDirectory, toDirectory string)
Recursively moves all content of fromDirectory into toDirectory, overwriting existing files when encountered.
func MustPutFile ¶
func MustReadFile ¶
func MustRemoveFile ¶
func MustRemoveFile(filePath string)
func TryRemoveDirectory ¶
func TryRemoveDirectory(path string)
func TryRemoveEmpty ¶
func TryRemoveEmpty(filePath string)
func UndeployProgram ¶
UndeployProgram renames the file at undeployProgramPath on operating systems where running binaries cannot be deleted (i.e. Windows) and returns the path to the renamed file. Otherwise, the provided string is returned with a non-nil error.
Types ¶
type FileSystemError ¶
type FileSystemError struct {
// contains filtered or unexported fields
}
func NewFileSystemError ¶ added in v1.4.0
func NewFileSystemError(message string, cause error) *FileSystemError
func (*FileSystemError) Error ¶
func (fse *FileSystemError) Error() string
func (*FileSystemError) Unwrap ¶ added in v1.4.0
func (fse *FileSystemError) Unwrap() error
type ProcessSignature ¶
func GetCurrentProcessSignature ¶
func GetCurrentProcessSignature() *ProcessSignature
func GetPidProcessSignature ¶
func GetPidProcessSignature(pid int) *ProcessSignature