Merge pull request #157 from ente-io/add-open-directory-api
Add open directory api
This commit is contained in:
commit
732ed6a827
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "ente",
|
||||
"productName": "ente",
|
||||
"version": "1.6.24-alpha.2",
|
||||
"version": "1.6.24-alpha.4",
|
||||
"private": true,
|
||||
"description": "Desktop client for ente.io",
|
||||
"main": "app/main.js",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -6,7 +6,7 @@ export const exists = (path: string) => {
|
|||
return fs.existsSync(path);
|
||||
};
|
||||
|
||||
export const checkExistsAndCreateCollectionDir = async (dirPath: string) => {
|
||||
export const checkExistsAndCreateDir = async (dirPath: string) => {
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
await fs.mkdir(dirPath);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import { getEncryptionKey, setEncryptionKey } from './api/safeStorage';
|
|||
import { clearElectronStore } from './api/electronStore';
|
||||
import { openDiskCache, deleteDiskCache } from './api/cache';
|
||||
import {
|
||||
checkExistsAndCreateCollectionDir,
|
||||
checkExistsAndCreateDir,
|
||||
checkExistsAndRename,
|
||||
saveStreamToDisk,
|
||||
saveFileToDisk,
|
||||
|
@ -42,6 +42,7 @@ import {
|
|||
openLogDirectory,
|
||||
getSentryUserID,
|
||||
getAppVersion,
|
||||
openDirectory,
|
||||
} from './api/common';
|
||||
import { fixHotReloadNext12 } from './utils/preload';
|
||||
import { isFolder, getDirFiles } from './api/fs';
|
||||
|
@ -61,7 +62,7 @@ const windowObject: any = window;
|
|||
|
||||
windowObject['ElectronAPIs'] = {
|
||||
exists,
|
||||
checkExistsAndCreateCollectionDir,
|
||||
checkExistsAndCreateDir,
|
||||
checkExistsAndRename,
|
||||
saveStreamToDisk,
|
||||
saveFileToDisk,
|
||||
|
@ -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();
|
||||
});
|
||||
|
|
2
ui
2
ui
|
@ -1 +1 @@
|
|||
Subproject commit f31d94e2cb98fad8a8d15f03185ea1c4b60d5cf4
|
||||
Subproject commit 6ec29b9affc9e7630e098c16b15c98994afff6aa
|
Loading…
Reference in a new issue