Hello,

I'm trying to get the root drive from my application. I'm using Windows 7 and I have 2 drives (C:\ and D:\). The drive C:\ is where my OS is installed and the drive D:\ is where my application is running.

This is a piece of code from my application:
Qt Code:
  1. QString m_app_dir = "D:/slave";
  2. QDir dir;
  3. dir.setPath (m_app_dir);
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. QString r = dir.root ().path ();
To copy to clipboard, switch view to plain text mode 
or
Qt Code:
  1. QString r = dir.root ().absolutePath ();
To copy to clipboard, switch view to plain text mode 

Both codes return C:\, is that the expected result?
If so, what would return D:\?

From Qt docs about root (): http://qt-project.org/doc/qt-5/qdir.html#root
Returns the root directory.
The directory is constructed using the absolute path of the root directory, ensuring that its path() will be the same as its absolutePath().
So I was assuming D:\ would be the return of the root() method.

Thanks,
Renan