open a file with default program in node-webkit

前端 未结 5 986
刺人心
刺人心 2020-12-28 21:59

I want to give the user any option he want to edit a file, how can I open a file with the default program of the specific file type? I need it to work with Windows and Linux

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 22:58

    Detect the platform and use:

    • 'start' on Windows
    • 'open' on Macs
    • 'xdg-open' on Linux

提交回复
热议问题