From ea198c51234e0e0b5a228c8fe6690f6cf28ea432 Mon Sep 17 00:00:00 2001 From: Ayushman Chhabra <14110965+ayushmanchhabra@users.noreply.github.com> Date: Sun, 17 Dec 2023 23:35:12 -0500 Subject: [PATCH] get: refactor symlink declaration --- src/get.js | 12 ++++++------ t.js | 5 ----- 2 files changed, 6 insertions(+), 11 deletions(-) delete mode 100644 t.js diff --git a/src/get.js b/src/get.js index 8771f8cb5..455d9f7c8 100644 --- a/src/get.js +++ b/src/get.js @@ -360,14 +360,14 @@ const getNodeHeaders = async (options) => { } const createSymlinks = async (options) => { + const frameworksPath = path.join(process.cwd(), options.cacheDir, `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`, "nwjs.app", "Contents", "Frameworks", "nwjs Framework.framework"); const symlinks = [ - path.resolve(options.cacheDir, `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`, "nwjs.app", "Contents", "Frameworks", "nwjs Framework.framework", "Helpers"), - path.resolve(options.cacheDir, `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`, "nwjs.app", "Contents", "Frameworks", "nwjs Framework.framework", "Libraries"), - path.resolve(options.cacheDir, `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`, "nwjs.app", "Contents", "Frameworks", "nwjs Framework.framework", "nwjs Framework"), - path.resolve(options.cacheDir, `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`, "nwjs.app", "Contents", "Frameworks", "nwjs Framework.framework", "Resources"), - path.resolve(options.cacheDir, `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`, "nwjs.app", "Contents", "Frameworks", "nwjs Framework.framework", "Versions", "Current"), + path.join(frameworksPath, "Helpers"), + path.join(frameworksPath, "Libraries"), + path.join(frameworksPath, "nwjs Framework"), + path.join(frameworksPath, "Resources"), + path.join(frameworksPath, "Versions", "Current"), ]; - for await (const symlink of symlinks) { const link = String(await fsm.readFile(symlink)); await fsm.rm(symlink); diff --git a/t.js b/t.js deleted file mode 100644 index 3a5431606..000000000 --- a/t.js +++ /dev/null @@ -1,5 +0,0 @@ -import fs from "node:fs"; - -fs.stat("./test/fixture/cache/nwjs-sdk-v0.82.0-osx-x64/nwjs.app/Contents/Frameworks/nwjs Framework.framework/Helpers", (err, stats) => { - console.log(stats.isSymbolicLink()) -});