* Gets the path to the directory where Wave configurations are stored. Creates the directory if it does not exist. * Handles backwards compatibility with the old Wave Home directory model, where configurations and data were stored together. * @returns The path where configurations should be stored
()
| 104 | * @returns The path where configurations should be stored. |
| 105 | */ |
| 106 | function getWaveConfigDir(): string { |
| 107 | // If wave home dir exists, use it for backwards compatibility |
| 108 | const waveHomeDir = getWaveHomeDir(); |
| 109 | if (waveHomeDir) { |
| 110 | return path.join(waveHomeDir, "config"); |
| 111 | } |
| 112 | |
| 113 | const override = process.env[WaveConfigHomeVarName]; |
| 114 | const xdgConfigHome = process.env.XDG_CONFIG_HOME; |
| 115 | let retVal: string; |
| 116 | if (override) { |
| 117 | retVal = override; |
| 118 | } else if (xdgConfigHome) { |
| 119 | retVal = path.join(xdgConfigHome, waveDirName); |
| 120 | } else { |
| 121 | retVal = path.join(app.getPath("home"), ".config", waveDirName); |
| 122 | } |
| 123 | return ensurePathExists(retVal); |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Gets the path to the directory where Wave data is stored. Creates the directory if it does not exist. |
no test coverage detected