shadowm icon

Untitled

shadowm | PRO | 09/20/16 07:48:37 AM UTC | 0 ⭐ | 293 👁️ | Never ⏰ | []
C++ |

630 B

|

None

|

0 👍

/

0 👎

std::vector<std::string> enumerate_filesystems()
{
    std::vector<std::string> res;
 
#ifdef _WIN32
 
    const DWORD drive_table = GetLogicalDrives();
 
    for(unsigned n = 0; n < 26; ++n) {
        if((drive_table >> n) & 1) {
            res.emplace_back(2, char(65 + n));
            res.back()[1] = ':';
        }
    }
 
#elif !defined(__APPLE__)
 
    // FIXME: Sensible guesses. It'll be far too much work to implement a more
    //        factual version that works reliably across multiple POSIX
    //        platforms, at least without adding new build dependencies.
 
    res.push_back("/home");
    res.push_back("/media");
    res.push_back("/");
 
#endif
 
    return res;
}

Comments