Check mount location
This commit is contained in:
@@ -58,34 +58,51 @@ class MountItems extends Component {
|
||||
};
|
||||
|
||||
handleMountUnMount = (storageType, mount, location) => {
|
||||
if (ipcRenderer) {
|
||||
const state = {
|
||||
...this.state[storageType],
|
||||
AllowMount: false,
|
||||
};
|
||||
|
||||
this.props.mountsBusy(true);
|
||||
|
||||
this.setState({
|
||||
[storageType]: state,
|
||||
}, ()=> {
|
||||
if (mount) {
|
||||
ipcRenderer.send(Constants.IPC_Mount_Drive, {
|
||||
Directory: this.props.directory,
|
||||
if (!location || (location.trim().length === 0)) {
|
||||
this.props.errorHandler('Mount location is not set');
|
||||
} else {
|
||||
if (ipcRenderer) {
|
||||
let allowAction = true;
|
||||
if (mount && (this.props.platform !== 'win32')) {
|
||||
const result = ipcRenderer.sendSync(Constants.IPC_Check_Mount_Location, {
|
||||
Location: location,
|
||||
NoConsoleSupported: this.props.noConsoleSupported,
|
||||
StorageType: storageType,
|
||||
Version: this.props.version,
|
||||
});
|
||||
} else {
|
||||
ipcRenderer.send(Constants.IPC_Unmount_Drive, {
|
||||
Directory: this.props.directory,
|
||||
Location: location,
|
||||
StorageType: storageType,
|
||||
Version: this.props.version,
|
||||
if (!result.Success) {
|
||||
allowAction = false;
|
||||
this.props.errorHandler(result.Error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (allowAction) {
|
||||
const state = {
|
||||
...this.state[storageType],
|
||||
AllowMount: false,
|
||||
};
|
||||
|
||||
this.props.mountsBusy(true);
|
||||
|
||||
this.setState({
|
||||
[storageType]: state,
|
||||
}, () => {
|
||||
if (mount) {
|
||||
ipcRenderer.send(Constants.IPC_Mount_Drive, {
|
||||
Directory: this.props.directory,
|
||||
Location: location,
|
||||
NoConsoleSupported: this.props.noConsoleSupported,
|
||||
StorageType: storageType,
|
||||
Version: this.props.version,
|
||||
});
|
||||
} else {
|
||||
ipcRenderer.send(Constants.IPC_Unmount_Drive, {
|
||||
Directory: this.props.directory,
|
||||
Location: location,
|
||||
StorageType: storageType,
|
||||
Version: this.props.version,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user