move doesFolderExists to common api

This commit is contained in:
Abhinav 2022-06-15 11:44:56 +05:30
parent 8fe23a4da1
commit 64acef79d3

View file

@ -1,4 +1,5 @@
import { ipcRenderer } from 'electron';
import fs from 'promise-fs';
export const sendNotification = (content: string) => {
ipcRenderer.send('send-notification', content);
@ -9,3 +10,12 @@ export const showOnTray = (content: string) => {
export const reloadWindow = () => {
ipcRenderer.send('reload-window');
};
export async function doesFolderExists(dirPath: string) {
return await fs
.stat(dirPath)
.then((stats) => {
return stats.isDirectory();
})
.catch(() => false);
}