Documentation ¶
Index ¶
- Variables
- func Arch() string
- func Exists(fileName string) bool
- func HostName() (string, error)
- func ID() (string, error)
- func Init(options ...Option) error
- func IsAndroid() bool
- func IsDesktop() bool
- func IsFile(fileName string) bool
- func IsIOS() bool
- func IsLinux() bool
- func IsMacOS() bool
- func IsMobile() bool
- func IsWindows() bool
- func Platform() string
- func Stat() (map[string]string, error)
- type FilePathOptFunc
- type FilePathOption
- type Folder
- func (f Folder) Create(fileName string) (*os.File, error)
- func (f Folder) CreateFolder(dirName string) (Folder, error)
- func (f Folder) Delete(fileName string) error
- func (f Folder) Exists(fileName string) bool
- func (f Folder) GenPath(path string, opts ...FilePathOption) (string, error)
- func (f Folder) JoinPath(ps ...string) string
- func (f Folder) MkdirAll() error
- func (f Folder) Path() string
- func (f Folder) ReadFile(fileName string) ([]byte, error)
- func (f Folder) WriteFile(fileName string, data []byte) error
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Path Manipulation Errors ErrDuplicateFilePathOption = errors.New("Duplicate file path option") ErrPrefixSuffixSetWithReplace = errors.New("Prefix or Suffix set with Replace.") ErrSeparatorLength = errors.New("Separator length must be 1.") ErrNoFileNameSet = errors.New("File name was not set by options.") // Device ID Errors ErrEmptyDeviceID = errors.New("Device ID cannot be empty") ErrMissingEnvVar = errors.New("Cannot set EnvVariable with empty value") // Directory errors ErrDirectoryInvalid = errors.New("Directory Type is invalid") ErrDirectoryUnset = errors.New("Directory path has not been set") ErrDirectoryJoin = errors.New("Failed to join directory path") )
Functions ¶
func IsDesktop ¶
func IsDesktop() bool
IsDesktop returns true if the current platform is ANY desktop platform.
func IsMobile ¶
func IsMobile() bool
IsMobile returns true if the current platform is ANY mobile platform.
Types ¶
type FilePathOptFunc ¶
type FilePathOptFunc func(path string) FilePathOption
FilePathOptFunc is a function that returns a FilePathOption.
var WithPrefix FilePathOptFunc = func(path string) FilePathOption {
return &filePathOpt{
filePathOptType: filePathOptionTypePrefix,
value: path,
}
}
WithPrefix sets the prefix for the file path.
var WithReplace FilePathOptFunc = func(path string) FilePathOption {
return &filePathOpt{
filePathOptType: filePathOptionTypeReplace,
value: path,
}
}
WithReplace sets the replace string for the file path.
var WithSeparator FilePathOptFunc = func(path string) FilePathOption {
return &filePathOpt{
filePathOptType: filePathOptionTypeSeparator,
value: path,
}
}
WithSeparator sets the separator for the file path.
var WithSuffix FilePathOptFunc = func(path string) FilePathOption {
return &filePathOpt{
filePathOptType: filePathOptionTypeSuffix,
value: path,
}
}
WithSuffix sets the suffix for the file path.
type FilePathOption ¶
type FilePathOption interface {
Apply() *filePathOptions
}
FilePathOption is a function option for FilePath.
type Folder ¶
type Folder string
var ( // Determined/Provided Paths Home Folder // ApplicationDocumentsDir on Mobile, HOME_DIR on Desktop Support Folder // AppSupport Directory Temporary Folder // AppCache Directory // Calculated Paths Database Folder // Device DB Folder Downloads Folder // Temporary Directory on Mobile for Export, Downloads on Desktop Wallet Folder // Encrypted Storage Directory ThirdParty Folder // Sub-Directory of Support, used for Textile )
func (Folder) CreateFolder ¶
CreateFolder creates a folder.
func (Folder) GenPath ¶
func (f Folder) GenPath(path string, opts ...FilePathOption) (string, error)
GenPath generates a path from a folder and a file name.
type Option ¶
type Option func(o *options)
func WithSupportPath ¶
WithSupportPath sets the Support Directory
Click to show internal directories.
Click to hide internal directories.