Skip to content

Commit

Permalink
Fix Step4 not opening folders correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Alamantus committed Dec 2, 2020
1 parent ce17473 commit 4d77ae3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion public/electron.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { app, BrowserWindow, ipcMain, dialog } = require('electron');
const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron');
const path = require('path');
const isDev = require('electron-is-dev');
const extractZip = require('./extract');
Expand Down Expand Up @@ -75,4 +75,8 @@ ipcMain.handle('organize', (event, unzipFolderPath, organizeIntoPath, renameStra
organize(unzipFolderPath, organizeIntoPath, renameStrategy, insertExif, (report) => {
mainWindow.webContents.send('progress', report);
});
});

ipcMain.handle('open-folder', (event, folderPath) => {
shell.openPath(folderPath);
});
8 changes: 4 additions & 4 deletions src/Views/Step4.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shell } from 'electron';
import { ipcRenderer } from 'electron';
import { NAV_ITEMS } from '../constants';

function Step4(props) {
Expand Down Expand Up @@ -35,21 +35,21 @@ function Step4(props) {
<button
className="btn btn-default"
disabled={ props.zipFolderPath === null }
onClick={() => shell.openItem(props.zipFolderPath)}
onClick={() => ipcRenderer.invoke('open-folder', props.zipFolderPath)}
>
Open Folder where the <code>.zip</code> Files Are
</button>
<button
className="btn btn-default"
disabled={ props.unzipFolderPath === null }
onClick={() => shell.openItem(props.unzipFolderPath)}
onClick={() => ipcRenderer.invoke('open-folder', props.unzipFolderPath)}
>
Open Emptied Folders for Tidying
</button>
<button
className="btn btn-primary"
disabled={ props.organizeIntoPath === null }
onClick={() => shell.openItem(props.organizeIntoPath)}
onClick={() => ipcRenderer.invoke('open-folder', props.organizeIntoPath)}
>
Open Folder with Organized Photos
</button>
Expand Down

0 comments on commit 4d77ae3

Please sign in to comment.