Skip to content

Commit

Permalink
fix(events): Fix js exception error after clone
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Hess committed Jun 10, 2018
1 parent a2614bf commit 7253364
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/modules/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,13 @@ export class Events {

ipcOpenFolder () {
ipcMain.on('open-folder', (event, opts) => {
fs.stat(opts.folder, (err, stat) => {
const currentBaseDir = opts.folder.split(path.sep + opts.owner)[0];
fs.stat(opts, (err, stat) => {
const currentBaseDir = opts.split(path.sep + opts.owner)[0];
const compareBaseDir = global.baseCloneDir === currentBaseDir;
if(err == null) {
// console.warn('folder exists');
const opened = shell.openItem(opts.folder);
event.sender.send('log', 'open-folder', [opts.folder, opened]);
const opened = shell.openItem(opts);
event.sender.send('log', 'open-folder', [opts, opened]);
} else if(!compareBaseDir) {
const directory = path.join(global.baseCloneDir, opts.owner, opts.name);
// console.warn('folder does not exist');
Expand All @@ -442,9 +442,9 @@ export class Events {
this.utilsDb.updateById(opts._id, {
folder: directory,
}, 'updatedAt');
opts.folder = directory;
const opened = shell.openItem(opts.folder);
event.sender.send('log', 'open-folder', [opts.folder, opened]);
opts = directory;
const opened = shell.openItem(opts);
event.sender.send('log', 'open-folder', [opts, opened]);
}
// console.warn('compare folders', global.baseCloneDir, currentBaseDir, compareBaseDir);
});
Expand Down

0 comments on commit 7253364

Please sign in to comment.