added new openDirectory api
This commit is contained in:
parent
bbd3d7aae9
commit
fd60c5c826
|
@ -18,6 +18,15 @@ export const getAppVersion = async (): Promise<string> => {
|
|||
}
|
||||
};
|
||||
|
||||
export const openDirectory = async (dirPath: string): Promise<void> => {
|
||||
try {
|
||||
await ipcRenderer.invoke('open-dir', dirPath);
|
||||
} catch (e) {
|
||||
logError(e, 'error while opening directory');
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
logToDisk,
|
||||
openLogDirectory,
|
||||
|
|
|
@ -42,6 +42,7 @@ import {
|
|||
openLogDirectory,
|
||||
getSentryUserID,
|
||||
getAppVersion,
|
||||
openDirectory,
|
||||
} from './api/common';
|
||||
import { fixHotReloadNext12 } from './utils/preload';
|
||||
import { isFolder, getDirFiles } from './api/fs';
|
||||
|
@ -103,4 +104,5 @@ windowObject['ElectronAPIs'] = {
|
|||
generateImageThumbnail,
|
||||
logRendererProcessMemoryUsage,
|
||||
registerForegroundEventListener,
|
||||
openDirectory,
|
||||
};
|
||||
|
|
|
@ -113,6 +113,10 @@ export default function setupIpcComs(
|
|||
shell.openPath(app.getPath('logs'));
|
||||
});
|
||||
|
||||
ipcMain.handle('open-dir', (_, dirPath) => {
|
||||
shell.openPath(dirPath);
|
||||
});
|
||||
|
||||
ipcMain.on('update-and-restart', () => {
|
||||
updateAndRestart();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue