Guest User

Untitled

a guest
Nov 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. if (process.platform === 'win32') {
  2. getWindowsDrives((error, drives) => {
  3. if (!error) {
  4. this.drives = drives
  5. // work through the drives backwards
  6. for (let index = this.drives.length - 1; index >= 0; --index) {
  7. try {
  8. const stat = fs.statSync(this.drives[index] + path.sep)
  9. let fileInfo = {}
  10. fileInfo.rootDir = this.drives[index]
  11. fileInfo.fileName = path.sep
  12. fileInfo.isDir = stat.isDirectory()
  13. fileInfo.stat = stat
  14. let node = this.createNode(fileInfo)
  15. this.rootDir.unshift(node)
  16. }
  17. catch (error) {
  18. // remove from (bad/phantom) drive list
  19. this.drives.splice(index, 1)
  20. console.error(error)
  21. }
  22. }
  23. }
  24. })
  25. }
  26. else {
  27. // set and get root folder's folders
  28. this.setSelectedFolder(this.drive + path.sep)
  29. this.rootDir.push(...this.getFolders(this.selectedFolder))
  30. }
Add Comment
Please, Sign In to add comment