Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (process.platform === 'win32') {
- getWindowsDrives((error, drives) => {
- if (!error) {
- this.drives = drives
- // work through the drives backwards
- for (let index = this.drives.length - 1; index >= 0; --index) {
- try {
- const stat = fs.statSync(this.drives[index] + path.sep)
- let fileInfo = {}
- fileInfo.rootDir = this.drives[index]
- fileInfo.fileName = path.sep
- fileInfo.isDir = stat.isDirectory()
- fileInfo.stat = stat
- let node = this.createNode(fileInfo)
- this.rootDir.unshift(node)
- }
- catch (error) {
- // remove from (bad/phantom) drive list
- this.drives.splice(index, 1)
- console.error(error)
- }
- }
- }
- })
- }
- else {
- // set and get root folder's folders
- this.setSelectedFolder(this.drive + path.sep)
- this.rootDir.push(...this.getFolders(this.selectedFolder))
- }
Add Comment
Please, Sign In to add comment