Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrOSNotSupportedUserDirs = fmt.Errorf("RetrieveUserDirs doesn't support this operating system") ErrOSNotSupportedAppDirsSystemIOS = fmt.Errorf("cannot get system-wide app directories: iOS apps are inside a sandbox, therefore iOS apps cannot have system-wide app directories") )
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct { // Application directory. // If non-empty, it will be appended (path.Join'ed) at the end of returned paths. Subdir string // Application directory for Unix. Overrides `Subdir`. // If non-empty, it will be used instead of `Subdir` on Unix based systems and // appended (path.Join'ed) at the end of returned paths. SubdirUnix string // Application directory for macOS and iOS. Overrides `Subdir`. // If non-empty, it will be used instead // of `Subdir` on macOS & iOS and appended (path.Join'ed) at the end of returned paths. SubdirDarwinIOS string // Application directory for Windows. Overrides `Subdir`. // If non-empty, it will be used instead of `Subdir` on Windows and appended (path.Join'ed) // at the end of returned paths. SubdirWindows string // Application directory for Plan 9. Overrides `Subdir`. // If non-empty, it will be used instead of `Subdir` on Plan 9 and appended (path.Join'ed) // at the end of returned paths. SubdirPlan9 string // Don't append subdirectory if config path is (or it ends with) /etc on Unix. // // If true, returns /etc instead of /etc/subdir // // Also applies to $XDG_CONFIG_HOME. If the value of $XDG_CONFIG_HOME ends with /etc, // subdirectory will not be appended. NoEtcSubdir bool // Defines whether config directory should be synchronizable across devices. // // If true, instead of %USERPROFILE%\AppData\Local, %USERPROFILE%\AppData\Roaming is used (only with `ConfigDir`). // This doesn't have an effect on other systems and only applies to config directory. // // If you don't know what you're doing, just leave this as false. // This doesn't have an effect if `System` is set to true. UseRoaming bool // To prevent potential conflicts arising from the same directory being // returned by the `ConfigDir`, `StateDir`, and `CacheDir` methods, this variable can be used. // // If `SubdirState` is non-empty, and state path is the same path as one of the other paths, // `SubdirState` is appended at the end of state path to prevent overlap of files. // // `SubdirState` doesn't have an effect if `Subdir` is empty. SubdirState string // To prevent potential conflicts arising from the same directory being // returned by the `ConfigDir`, `StateDir`, and `CacheDir` methods, this variable can be used. // // If `SubdirCache` is non-empty, and cache path is the same path as one of the other paths, // `SubdirCache` is appended at the end of cache path to prevent overlap of files. // // `SubdirCache` doesn't have an effect if `Subdir` is empty. SubdirCache string }
type AppDirs ¶
type AppDirs struct { // For files for user to configure. ConfigDir string // For files that are needed for application to save its state and // continue where it left off. Files inside this directory typically // don't need user intervention. // // Example file: SQLite database. StateDir string // For files that are not needed to persist (just like with `TempDir`) // but should live longer than files in `TempDir`. // Apple documentation had explained this properly: "Generally speaking, // the application does not require cache data to operate properly, // but it can use cache data to improve performance." // // Since cache directory can be deleted, the app must be able to // re-create or download the files as needed. // // Example contents: compilation cache, downloaded packages that // are going to be installed, downloaded videos that are going to be // converted to audio format and deleted afterwards. CacheDir string }
type UserDirs ¶
type UserDirs struct { Desktop string Downloads string Documents string Pictures string Videos string Music string Fonts []string Templates string }
func RetrieveUserDirs ¶
On Linux, XDG directories may be unset. If a directory is unset, its value within `UserDirs` struct will be empty.
Click to show internal directories.
Click to hide internal directories.