| 49 | // Setup a local proxy to adjust the paths of requested files when loading |
| 50 | // them from the local production bundle (e.g.: local fonts, etc...). |
| 51 | function setupLocalFilesNormalizerProxy() { |
| 52 | protocol.registerHttpProtocol( |
| 53 | "file", |
| 54 | (request, callback) => { |
| 55 | const url = request.url.substr(8); |
| 56 | callback({ path: path.normalize(`${__dirname}/${url}`) }); |
| 57 | }, |
| 58 | (error) => { |
| 59 | if (error) console.error("Failed to register protocol"); |
| 60 | } |
| 61 | ); |
| 62 | } |
| 63 | |
| 64 | // This method will be called when Electron has finished its initialization and |
| 65 | // is ready to create the browser windows. |