Situation: I need to find the top level [root] directory of any operating system using the most Pythonic way possible, without system calls.
Problem: While I can check for the operating system using things like if "Windows" in platform.system()
, I cannot be too sure if the drive letter is always C:\
or /
(the latter being unlikely). I also cannot possibly be sure that there are only Windows and *NIXes that needs to be catalog.
Question: Is there a way to get the top level directory of any operating system? Preferably using the os
module since I am already using it.