* Gets the path to the directory where Wave data is 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 data should be stored.
()
| 129 | * @returns The path where data should be stored. |
| 130 | */ |
| 131 | function getWaveDataDir(): string { |
| 132 | // If wave home dir exists, use it for backwards compatibility |
| 133 | const waveHomeDir = getWaveHomeDir(); |
| 134 | if (waveHomeDir) { |
| 135 | return waveHomeDir; |
| 136 | } |
| 137 | |
| 138 | const override = process.env[WaveDataHomeVarName]; |
| 139 | const xdgDataHome = process.env.XDG_DATA_HOME; |
| 140 | let retVal: string; |
| 141 | if (override) { |
| 142 | retVal = override; |
| 143 | } else if (xdgDataHome) { |
| 144 | retVal = path.join(xdgDataHome, waveDirName); |
| 145 | } else { |
| 146 | retVal = paths.data; |
| 147 | } |
| 148 | return ensurePathExists(retVal); |
| 149 | } |
| 150 | |
| 151 | function getElectronAppBasePath(): string { |
| 152 | // import.meta.dirname in dev points to waveterm/dist/main |
no test coverage detected