Home / Function/ getGlobalPreferenceDir() — astro Function Reference

getGlobalPreferenceDir() — astro Function Reference

Architecture documentation for the getGlobalPreferenceDir() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  184aa0ef_9217_6c97_b371_4e61ea2042b7["getGlobalPreferenceDir()"]
  942f8bed_424f_0805_6c0b_154ed0869816["index.ts"]
  184aa0ef_9217_6c97_b371_4e61ea2042b7 -->|defined in| 942f8bed_424f_0805_6c0b_154ed0869816
  e5de314d_a01f_f2cf_1a35_e440abb1adca["createPreferences()"]
  e5de314d_a01f_f2cf_1a35_e440abb1adca -->|calls| 184aa0ef_9217_6c97_b371_4e61ea2042b7
  style 184aa0ef_9217_6c97_b371_4e61ea2042b7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/preferences/index.ts lines 135–156

function getGlobalPreferenceDir() {
	const name = 'astro';
	const homedir = os.homedir();
	const macos = () => path.join(homedir, 'Library', 'Preferences', name);
	const win = () => {
		const { APPDATA = path.join(homedir, 'AppData', 'Roaming') } = process.env;
		return path.join(APPDATA, name, 'Config');
	};
	const linux = () => {
		const { XDG_CONFIG_HOME = path.join(homedir, '.config') } = process.env;
		return path.join(XDG_CONFIG_HOME, name);
	};
	// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
	switch (process.platform) {
		case 'darwin':
			return macos();
		case 'win32':
			return win();
		default:
			return linux();
	}
}

Domain

Subdomains

Frequently Asked Questions

What does getGlobalPreferenceDir() do?
getGlobalPreferenceDir() is a function in the astro codebase, defined in packages/astro/src/preferences/index.ts.
Where is getGlobalPreferenceDir() defined?
getGlobalPreferenceDir() is defined in packages/astro/src/preferences/index.ts at line 135.
What calls getGlobalPreferenceDir()?
getGlobalPreferenceDir() is called by 1 function(s): createPreferences.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free