Check mount location
This commit is contained in:
23
electron.js
23
electron.js
@@ -261,6 +261,29 @@ ipcMain.on(Constants.IPC_Check_Installed, (event, data) => {
|
||||
});
|
||||
});
|
||||
|
||||
ipcMain.on(Constants.IPC_Check_Mount_Location, (event, data) => {
|
||||
let response = {
|
||||
Success: true,
|
||||
Error: ''
|
||||
};
|
||||
|
||||
try {
|
||||
if (fs.existsSync(data.Location) && fs.statSync(data.Location).isDirectory()) {
|
||||
if (fs.readdirSync(data.Location).length !== 0) {
|
||||
response.Success = false;
|
||||
response.Error = 'Directory not empty: ' + data.Location;
|
||||
}
|
||||
} else {
|
||||
response.Success = false;
|
||||
response.Error = 'Directory not found: ' + data.Location;
|
||||
}
|
||||
} catch (e) {
|
||||
response.Success = false;
|
||||
response.Error = e.toString();
|
||||
}
|
||||
event.returnValue = response;
|
||||
});
|
||||
|
||||
ipcMain.on(Constants.IPC_Delete_File, (event, data) => {
|
||||
try {
|
||||
if (fs.existsSync(data.FilePath)) {
|
||||
|
||||
Reference in New Issue
Block a user