On Windows platforms, the function first checks for a LOCALAPPDATA environment variable before checking for an APPDATA environment variable. This means that machine specific user configuration files have precedence over roaming user configuration files.
On non-Windows platforms, if the function is unable to locate the current user's home directory, the function returns null. Similarly, on Windows platforms, if the function is unable to locate an application data directory, the function also returns null.
Parameters
Optional p: undefined | string
Returns
string
directory
Example
var dir = configdir();
// e.g., returns '/Users/<username>/Library/Preferences'
Example
var dir = configdir( 'appname/config' );
// e.g., returns '/Users/<username>/Library/Preferences/appname/config'
Returns a directory for user-specific configuration files.
Notes
LOCALAPPDATA
environment variable before checking for anAPPDATA
environment variable. This means that machine specific user configuration files have precedence over roaming user configuration files.home
directory, the function returnsnull
. Similarly, on Windows platforms, if the function is unable to locate an application data directory, the function also returnsnull
.