| 148 | } |
| 149 | |
| 150 | const addDir = (win: BrowserWindow, pathname: string, type: WatchType): void => { |
| 151 | if (type === 'file') return |
| 152 | |
| 153 | const directory = { |
| 154 | pathname, |
| 155 | name: path.basename(pathname), |
| 156 | isCollapsed: true, |
| 157 | isDirectory: true, |
| 158 | isFile: false, |
| 159 | isMarkdown: false, |
| 160 | folders: [], |
| 161 | files: [] |
| 162 | } |
| 163 | |
| 164 | win.webContents.send('mt::update-object-tree', { |
| 165 | type: 'addDir', |
| 166 | change: directory |
| 167 | }) |
| 168 | } |
| 169 | |
| 170 | const unlinkDir = (win: BrowserWindow, pathname: string, type: WatchType): void => { |
| 171 | if (type === 'file') return |