| 29 | } |
| 30 | |
| 31 | static async open() { |
| 32 | console.log('Opening project...') |
| 33 | |
| 34 | ProjectHandler.close() |
| 35 | |
| 36 | ProjectHandler.projectIsOpen = true |
| 37 | |
| 38 | console.log('START: Starting watcher...') |
| 39 | |
| 40 | ProjectHandler.watcher = chokidar |
| 41 | .watch(ProjectPathResolver.getPath(), { |
| 42 | ignoreInitial: true, |
| 43 | ignored: [ |
| 44 | /(^|[\/\\])\../, |
| 45 | /node_modules/, |
| 46 | /vendor/, |
| 47 | /vemto\.log/ |
| 48 | ] |
| 49 | }) |
| 50 | .on("change", (event) => { |
| 51 | ProjectHandler.window.webContents.send("files:changed", { |
| 52 | file: event |
| 53 | }) |
| 54 | }) |
| 55 | .on("add", (event) => { |
| 56 | ProjectHandler.window.webContents.send("files:changed", { |
| 57 | file: event |
| 58 | }) |
| 59 | }) |
| 60 | .on("unlink", (event) => { |
| 61 | ProjectHandler.window.webContents.send("files:changed", { |
| 62 | file: event |
| 63 | }) |
| 64 | }) |
| 65 | |
| 66 | } |
| 67 | |
| 68 | static async close() { |
| 69 | ProjectHandler.projectIsOpen = false |