Skip to content

Commit

Permalink
feat(where): allow all paths to be set by env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
kumavis committed Aug 30, 2024
1 parent 67141a1 commit f19bdbd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/where/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const whereHomeWindows = (env, info) => {
* @type {typeof import('./types.js').whereEndoState}
*/
export const whereEndoState = (platform, env, info) => {
if (env.XDG_STATE_HOME !== undefined) {
if (env.ENDO_STATE !== undefined) {
return env.ENDO_STATE;
} else if (env.XDG_STATE_HOME !== undefined) {
return `${env.XDG_STATE_HOME}/endo`;
} else if (platform === 'win32') {
return `${whereHomeWindows(env, info)}\\Endo`;
Expand All @@ -59,7 +61,9 @@ export const whereEndoState = (platform, env, info) => {
* @type {typeof import('./types.js').whereEndoEphemeralState}
*/
export const whereEndoEphemeralState = (platform, env, info) => {
if (env.XDG_RUNTIME_DIR !== undefined) {
if (env.ENDO_TEMP_STATE !== undefined) {
return env.ENDO_TEMP_STATE;
} else if (env.XDG_RUNTIME_DIR !== undefined) {
return `${env.XDG_RUNTIME_DIR}/endo`;
} else if (platform === 'win32') {
return `${whereHomeWindows(env, info)}\\Temp\\Endo`;
Expand Down Expand Up @@ -102,7 +106,9 @@ export const whereEndoSock = (platform, env, info, protocol = 'captp0') => {
* @type {typeof import('./types.js').whereEndoCache}
*/
export const whereEndoCache = (platform, env, info) => {
if (env.XDG_CACHE_HOME !== undefined) {
if (env.ENDO_CACHE !== undefined) {
return env.ENDO_CACHE;
} else if (env.XDG_CACHE_HOME !== undefined) {
return `${env.XDG_CACHE_HOME}/endo`;
} else if (platform === 'win32') {
return `${whereHomeWindows(env, info)}\\Endo`;
Expand Down

0 comments on commit f19bdbd

Please sign in to comment.