Module: appdirs

appdirs

Platform specific directory locator. The API's all follow the same general pattern:
  • All arguments are optional. When called with no arguments, the function returns the base path, instead of one specific for an application.
  • The version is only appended if the appname is provided.
  • Windows requires the application author, in addition to the application name, for locating application specific directories. If not give, this defaults to appname.
  • Both the OS X and XDG implementations are portable, and will run on any platform.
  • Windows support is unimplemented, because reasons. When it is implemented, it will probably only run on Windows
Source:

Classes

AppDirs

Members

<static> darwin

OS X appdirs implementation. The standard directory structure for OS X can be found on the apple developer site.
Source:

<static> windows

Windows appdirs implementation. (unimplemented) The standard directory structure for Windows can be found on MSDN.
Source:

<static> xdg

XDG appdirs implementation. The is the standard directory structure appdirs uses for *NIX operating systems. The XDG spec can be found on the FreeDesktop standards site.
Source:

Methods

<static> siteConfigDir(appname, appauthor, version, multipath) → {string}

Return full path to the user-shared config dir for this application. Typical user data directories are:
Mac OS X
same as site_data_dir
Unix
/etc/xdg/{AppName}
Windows
same as site_data_dir
Parameters:
Name Type Argument Description
appname string <optional>
Application name. If not give, then the base site data directory is returned.
appauthor string <optional>
Application author's name. This falls back to appname.
version string <optional>
Optional version to append to the path. Only applied when appname is present.
multipath boolean <optional>
If true, on *NIX, all site data dirs are returned.
Source:
Returns:
Site config directory.
Type
string

<static> siteDataDir(appname, appauthor, version, multipath) → {string}

Return full path to the user-shared data dir for this application. Typical site data directories are:
Mac OS X
/Library/Application Support/{AppName}
Unix
/usr/local/share/{AppName} or /usr/share/{AppName}
Parameters:
Name Type Argument Description
appname string <optional>
Application name. If not give, then the base site data directory is returned.
appauthor string <optional>
Application author's name. This falls back to appname.
version string <optional>
Optional version to append to the path. Only applied when appname is present.
multipath boolean <optional>
If true, on *NIX, all site data dirs are returned.
Source:
Returns:
Site data directory.
Type
string

<static> userCacheDir(appname, appauthor, version) → {string}

Return full path to the user-specific cache dir for this application. Typical user cache directories are:
Mac OS X
~/Library/Caches/{AppName}
Unix
~/.cache/{AppName}
Parameters:
Name Type Argument Description
appname string <optional>
Application name. If not give, then the base user cache directory is returned.
appauthor string <optional>
Application author's name. This falls back to appname.
version string <optional>
Optional version to append to the path. Only applied when appname is present.
Source:
Returns:
User cache directory
Type
string

<static> userConfigDir(appname, appauthor, version, roaming) → {string}

Return full path to the user-specific config dir for this application. Typical user data directories are:
Mac OS X
same as user_data_dir
Unix
~/.config/{AppName}
Windows
same as user_data_dir
Parameters:
Name Type Argument Description
appname string <optional>
Application name. If not give, then the base user config directory is returned.
appauthor string <optional>
Application author's name. This falls back to appname.
version string <optional>
Optional version to append to the path. Only applied when appname is present.
roaming boolean <optional>
When set, use the Windows roaming appdata directory
Source:
Returns:
User config directory.
Type
string

<static> userDataDir(appname, appauthor, version, roaming) → {string}

Return full path to the user-specific data dir for this application. Typical user cache directories are:
Mac OS X
~/Library/Application Support/{AppName}
Unix
~/.local/share/{AppName}/log
Win 7 (not roaming)
C:\Users\{username}\AppData\Local\{AppAuthor}\{AppName}
Win 7 (roaming)
C:\Users\{username}\AppData\Roaming\{AppAuthor}\{AppName}
Parameters:
Name Type Argument Description
appname string <optional>
Application name. If not give, then the base user data directory is returned.
appauthor string <optional>
Application author's name. This falls back to appname.
version string <optional>
Optional version to append to the path. Only applied when appname is present.
roaming boolean <optional>
When set, use the Windows roaming appdata directory
Source:
Returns:
User data directory.
Type
string

<static> userLogDir(appname, appauthor, version) → {string}

Return full path to the user-specific log dir for this application. Typical user cache directories are:
Mac OS X
~/Library/Logs/{AppName}
Unix
~/.cache/{AppName}/log
Parameters:
Name Type Argument Description
appname string <optional>
Application name. If not give, then the base site data directory is returned.
appauthor string <optional>
Application author's name. This falls back to appname.
version string <optional>
Optional version to append to the path. Only applied when appname is present.
Source:
Returns:
User log directory.
Type
string