shadowm

Untitled

Sep 20th, 2016
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. std::vector<std::string> enumerate_filesystems()
  2. {
  3.     std::vector<std::string> res;
  4.  
  5. #ifdef _WIN32
  6.  
  7.     const DWORD drive_table = GetLogicalDrives();
  8.  
  9.     for(unsigned n = 0; n < 26; ++n) {
  10.         if((drive_table >> n) & 1) {
  11.             res.emplace_back(2, char(65 + n));
  12.             res.back()[1] = ':';
  13.         }
  14.     }
  15.  
  16. #elif !defined(__APPLE__)
  17.  
  18.     // FIXME: Sensible guesses. It'll be far too much work to implement a more
  19.     //        factual version that works reliably across multiple POSIX
  20.     //        platforms, at least without adding new build dependencies.
  21.  
  22.     res.push_back("/home");
  23.     res.push_back("/media");
  24.     res.push_back("/");
  25.  
  26. #endif
  27.  
  28.     return res;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment