Get the path to the current application in node-webkit

后端 未结 1 956
时光取名叫无心
时光取名叫无心 2021-02-15 11:40

In node-webkit, is there any way to find the path to the current application? In node.js, you can use __dirname to find the path to the current application, but in

相关标签:
1条回答
  • 2021-02-15 12:20

    The answer to this question was discussed here: https://groups.google.com/d/topic/node-webkit/IwGzluFC9iU/discussion

    On Windows, use "process.execPath" to see the path of the executable that launched it. Then work from there, removing the executable's filename from the path to get the folder's path (assuming your app's .nw is relative to the executable or is combined with it).

    This works for me whether it is running with the zipped 'app.nw' or where 'nw.exe' and 'app.nw' are combined into one executable file (app.exe).

    0 讨论(0)
提交回复
热议问题