From 1d19501064295da47e7e1b74bde9a69ca022c5b9 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 6 Oct 2021 08:57:38 -0400 Subject: [PATCH] Use agnostic getPath function is migrations Signed-off-by: Sebastian Malton --- src/migrations/user-store/5.0.3-beta.1.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/migrations/user-store/5.0.3-beta.1.ts b/src/migrations/user-store/5.0.3-beta.1.ts index 05a1767f08..ea1c9dde52 100644 --- a/src/migrations/user-store/5.0.3-beta.1.ts +++ b/src/migrations/user-store/5.0.3-beta.1.ts @@ -19,22 +19,21 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { app } from "electron"; import { existsSync, readFileSync } from "fs"; import path from "path"; import os from "os"; import type { ClusterStoreModel } from "../../common/cluster-store"; import type { KubeconfigSyncEntry, UserPreferencesModel } from "../../common/user-store"; import { MigrationDeclaration, migrationLog } from "../helpers"; -import { isLogicalChildPath, storedKubeConfigFolder } from "../../common/utils"; +import { getPath, isLogicalChildPath, storedKubeConfigFolder } from "../../common/utils"; export default { version: "5.0.3-beta.1", run(store) { try { const { syncKubeconfigEntries = [], ...preferences }: UserPreferencesModel = store.get("preferences") ?? {}; - const { clusters = [] }: ClusterStoreModel = JSON.parse(readFileSync(path.resolve(app.getPath("userData"), "lens-cluster-store.json"), "utf-8")) ?? {}; - const extensionDataDir = path.resolve(app.getPath("userData"), "extension_data"); + const { clusters = [] }: ClusterStoreModel = JSON.parse(readFileSync(path.resolve(getPath("userData"), "lens-cluster-store.json"), "utf-8")) ?? {}; + const extensionDataDir = path.resolve(getPath("userData"), "extension_data"); const syncPaths = new Set(syncKubeconfigEntries.map(s => s.filePath)); syncPaths.add(path.join(os.homedir(), ".kube"));