OS X changes

This commit is contained in:
Scott E. Graves
2018-11-08 12:47:52 -06:00
parent f7574c0815
commit acfeb4a9a2
5 changed files with 97 additions and 99 deletions

View File

@@ -155,6 +155,19 @@ const standardIPCReply = (event, channel, data, error) => {
});
};
ipcMain.on(Constants.IPC_Check_Dependency_Installed, (event, data) => {
try {
const exists = fs.lstatSync(data.File).isFile();
standardIPCReply(event, Constants.IPC_Check_Dependency_Installed_Reply, {
Exists: exists,
});
} catch (e) {
standardIPCReply(event, Constants.IPC_Check_Dependency_Installed_Reply, {
Exists: false,
}, e);
}
});
ipcMain.on(Constants.IPC_Check_Installed, (event, data) => {
const dataDirectory = helpers.resolvePath(data.Directory);
const destination = path.join(dataDirectory, data.Version);
@@ -406,18 +419,37 @@ ipcMain.on(Constants.IPC_Grab_UI_Releases, (event) => {
});
ipcMain.on(Constants.IPC_Install_Dependency, (event, data) => {
helpers
if (data.Source.toLowerCase().endsWith('.dmg')) {
helpers
.executeAsync('hdiutil', ['attach', data.Source])
.then(() => {
standardIPCReply(event, Constants.IPC_Install_Dependency_Reply, {
Source: data.Source,
URL: data.URL,
});
})
.catch(error=> {
standardIPCReply(event, Constants.IPC_Install_Dependency_Reply, {
Source: data.Source,
URL: data.URL,
}, error);
});
} else {
helpers
.executeAndWait(data.Source)
.then(()=> {
.then(() => {
standardIPCReply(event, Constants.IPC_Install_Dependency_Reply, {
Source: data.Source,
URL: data.URL,
});
})
.catch(error => {
standardIPCReply(event, Constants.IPC_Install_Dependency_Reply, {
Source: data.Source,
URL: data.URL,
}, error);
});
}
});
ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {