| 64 | // This function is used to get the [local] app data path |
| 65 | // based on the platform. Use this for logs etc. |
| 66 | const getLocalAppDataPath = () => { |
| 67 | let localAppDataPath = app.getPath('userData'); |
| 68 | if(process.platform == 'linux' && 'XDG_DATA_HOME' in process.env) { |
| 69 | localAppDataPath = path.join(process.env.XDG_DATA_HOME, app.name); |
| 70 | } |
| 71 | |
| 72 | // Create directory if not exists |
| 73 | createDir(localAppDataPath); |
| 74 | |
| 75 | return localAppDataPath; |
| 76 | }; |
| 77 | |
| 78 | // This function is used to get the random available TCP port |
| 79 | // if fixedPort is set to 0. Else check whether port is in used or not. |