MCPcopy Create free account
hub / github.com/Moonvy/Figma-Net-OK / getScriptPath

Function getScriptPath

app/lib/sudoCallSetHosts.js:8–21  ·  view source on GitHub ↗
(scriptName)

Source from the content-addressed store, hash-verified

6
7// 智能获取脚本路径(兼容开发和打包环境)
8function getScriptPath(scriptName) {
9 // 开发时:__dirname 是 lib/,脚本在同目录
10 let scriptPath = resolve(__dirname, scriptName)
11 if (fs.existsSync(scriptPath)) {
12 return scriptPath
13 }
14 // 打包后:__dirname 是 res/,脚本在 lib/ 子目录
15 scriptPath = resolve(__dirname, "lib", scriptName)
16 if (fs.existsSync(scriptPath)) {
17 return scriptPath
18 }
19 // 回退
20 return resolve(__dirname, scriptName)
21}
22
23// 智能获取 node 可执行文件路径
24function getNodePath() {

Callers 1

sudoCallSetHostsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected