Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let stat = await statPromise (path.join ('/Volumes', files [index]));
if (stat.isDirectory ()) {
drives.push ({
identifier: encodeURIComponent (path.join ('/Volumes', files [index])),
mount: path.join ('/Volumes', files [index]),
label: files [index]
});
}
}
}
}
break;
}
default: {
let devices = await systemInformation.blockDevices ();
if (Array.isArray (devices) && devices.length > 0) {
for (let index in devices) {
if (devices [index].physical === 'Local') {
drives.push (devices [index]);
}
}
}
}
}
} catch (error) {
console.error ('TCH_e API - ListDrives - ' + error.message);
}
event.sender.send ('drives-list', {
drives
private async GetDriveLetters(): Promise {
let devices = await Si.blockDevices();
let letters: string[] = [];
for (let device of devices)
letters.push(device.mount);
return letters;
}