How can I list drives in Haskell? I would like to get drive letters on Windows and only get "/" on Linux. Is it possible? I could not find anything.
import System.Process c = do res <- readProcess "wmic" ["logicaldisk","get","caption"] "" --print res -- clean up the output print $ init $ map (take 2) $ drop 1(lines res)
You can try simply listing all 26 possible drive letters and see if they exist with doesDirectoryExist from System.Directory . I believe this will work ...
doesDirectoryExist
System.Directory