|
|
@ -1,22 +1,4 @@ |
|
|
|
import { BrowserWindow, MenuItemConstructorOptions, app, ipcMain } from 'electron'; |
|
|
|
import { BrowserWindow, MenuItemConstructorOptions, app, ipcMain } from 'electron'; |
|
|
|
import fs from 'fs' |
|
|
|
|
|
|
|
import os from 'os' |
|
|
|
|
|
|
|
import path from 'path' |
|
|
|
|
|
|
|
import { cacheDir } from '../utils/config'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let recentFolders: string[] = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fs.existsSync(cacheDir + '/remixdesktop.json')) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
// read the cache file
|
|
|
|
|
|
|
|
const cache = fs.readFileSync(cacheDir + '/remixdesktop.json') |
|
|
|
|
|
|
|
const data = JSON.parse(cache.toString()) |
|
|
|
|
|
|
|
recentFolders = data && data.recentFolders || [] |
|
|
|
|
|
|
|
console.log('recentFolders', recentFolders) |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default ( |
|
|
|
export default ( |
|
|
|
commandKeys: Record<string, string>, |
|
|
|
commandKeys: Record<string, string>, |
|
|
@ -47,19 +29,6 @@ export default ( |
|
|
|
execCommand('template:open', focusedWindow); |
|
|
|
execCommand('template:open', focusedWindow); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
|
|
|
|
role: 'recentDocuments', |
|
|
|
|
|
|
|
submenu: recentFolders.map((folder) => { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
label: folder, |
|
|
|
|
|
|
|
click(item, focusedWindow) { |
|
|
|
|
|
|
|
if(focusedWindow) { |
|
|
|
|
|
|
|
ipcMain.emit('fs:openFolder', focusedWindow.webContents.id, folder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
role: 'close', |
|
|
|
role: 'close', |
|
|
|
accelerator: commandKeys['window:close'] |
|
|
|
accelerator: commandKeys['window:close'] |
|
|
|