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 {
|
export {
|
||||||
logToDisk,
|
logToDisk,
|
||||||
openLogDirectory,
|
openLogDirectory,
|
||||||
|
|
|
@ -42,6 +42,7 @@ import {
|
||||||
openLogDirectory,
|
openLogDirectory,
|
||||||
getSentryUserID,
|
getSentryUserID,
|
||||||
getAppVersion,
|
getAppVersion,
|
||||||
|
openDirectory,
|
||||||
} from './api/common';
|
} from './api/common';
|
||||||
import { fixHotReloadNext12 } from './utils/preload';
|
import { fixHotReloadNext12 } from './utils/preload';
|
||||||
import { isFolder, getDirFiles } from './api/fs';
|
import { isFolder, getDirFiles } from './api/fs';
|
||||||
|
@ -103,4 +104,5 @@ windowObject['ElectronAPIs'] = {
|
||||||
generateImageThumbnail,
|
generateImageThumbnail,
|
||||||
logRendererProcessMemoryUsage,
|
logRendererProcessMemoryUsage,
|
||||||
registerForegroundEventListener,
|
registerForegroundEventListener,
|
||||||
|
openDirectory,
|
||||||
};
|
};
|
||||||
|
|
|
@ -113,6 +113,10 @@ export default function setupIpcComs(
|
||||||
shell.openPath(app.getPath('logs'));
|
shell.openPath(app.getPath('logs'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle('open-dir', (_, dirPath) => {
|
||||||
|
shell.openPath(dirPath);
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.on('update-and-restart', () => {
|
ipcMain.on('update-and-restart', () => {
|
||||||
updateAndRestart();
|
updateAndRestart();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue