[Interest] When is QDir::Drives useful?

Nikos Chantziaras realnc at gmail.com
Tue Jul 31 08:51:46 CEST 2012


On 31/07/12 09:33, André Somers wrote:
> Op 31-7-2012 8:30, André Somers schreef:
>> Op 31-7-2012 8:20, Nikos Chantziaras schreef:
>>> Nope.  I just tested it under Windows XP and 7.  The contents of "/" are
>>> the contents of "C:/".  Which makes sense, since Windows completely
>>> lacks the concept of a single root directory.  So I guess the question
>>> remains open.
>> Who said that / is the root directory on Windows?
>> Try "", or better yet, the result of QDir::rootPath();

Just tested.  QDir::rootPath() returns "C:\".


> BTW: note that for instance QFileSystemModel uses the same flags, and
> also can display the windows "root" directory (or My Computer) listing
> the drives.

"My Computer" is not an existing directory though.  It's a 
programmatically constructed, uhm, construct.

An alternative way to ask the question is: If you open a command prompt 
(cmd.exe), where would you have to "cd" into so that "dir" would list 
drives?




More information about the Interest mailing list