* Gets the path to the old Wave home directory (defaults to `~/.waveterm`). * @returns The path to the directory if it exists and contains valid data for the current app, otherwise null.
()
| 72 | * @returns The path to the directory if it exists and contains valid data for the current app, otherwise null. |
| 73 | */ |
| 74 | function getWaveHomeDir(): string { |
| 75 | let home = process.env[WaveHomeVarName]; |
| 76 | if (!home) { |
| 77 | const homeDir = app.getPath("home"); |
| 78 | if (homeDir) { |
| 79 | home = path.join(homeDir, `.${waveDirName}`); |
| 80 | } |
| 81 | } |
| 82 | // If home exists and it has `wave.lock` in it, we know it has valid data from Wave >=v0.8. Otherwise, it could be for WaveLegacy (<v0.8) |
| 83 | if (home && existsSync(home) && existsSync(path.join(home, "wave.lock"))) { |
| 84 | return home; |
| 85 | } |
| 86 | return null; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Ensure the given path exists, creating it recursively if it doesn't. |
no outgoing calls
no test coverage detected