2023-12-14 08:38:00 -06:00
|
|
|
import * as core from '@actions/core'
|
2023-04-10 20:36:00 -04:00
|
|
|
import * as os from 'os'
|
|
|
|
import * as path from 'path'
|
|
|
|
|
|
|
|
export function rtxDir(): string {
|
2023-12-14 08:38:00 -06:00
|
|
|
const dir = core.getState('RTX_DIR')
|
|
|
|
if (dir) return dir
|
|
|
|
|
|
|
|
const { RTX_DATA_DIR, XDG_DATA_HOME } = process.env
|
|
|
|
if (RTX_DATA_DIR) return RTX_DATA_DIR
|
|
|
|
if (XDG_DATA_HOME) return path.join(XDG_DATA_HOME, 'rtx')
|
|
|
|
|
2023-04-10 20:36:00 -04:00
|
|
|
return path.join(os.homedir(), '.local/share/rtx')
|
|
|
|
}
|