#26: Fix macOS dependency install

This commit is contained in:
Scott E. Graves
2019-06-28 21:01:14 -05:00
parent e2b9037be1
commit 8debe33882
2 changed files with 31 additions and 32 deletions

View File

@@ -59,8 +59,35 @@ export const installDependency = (source, url, completedCallback) => {
const installDependencyComplete = (event, arg) => {
ipcRenderer.removeListener(Constants.IPC_Install_Dependency_Reply, installDependencyComplete);
dispatch(setInstallComplete(arg.data));
completedCallback(source, url, arg.data);
const result = arg.data;
const handleCompleted = ()=> {
ipcRenderer.send(Constants.IPC_Delete_File, {
FilePath: source,
});
dispatch(setInstallComplete(result));
completedCallback(source, url, result);
};
if (result.Success && source.toLowerCase().endsWith('.dmg')) {
const dep = getState().install.MissingDependencies.find(d => {
return d.download === url;
});
const i = setInterval(()=> {
const ret = ipcRenderer.sendSync(Constants.IPC_Check_Dependency_Installed + '_sync', {
File: dep.file,
});
if (ret.data.Exists) {
clearInterval(i);
setTimeout(() => {
handleCompleted();
}, 5000);
}
}, 3000);
} else {
handleCompleted();
}
};
ipcRenderer.on(Constants.IPC_Install_Dependency_Reply, installDependencyComplete);