Aashu10
Aashu10

Reputation: 49

Getting current working drive in Qt

I want to get my current working DRIVE, not path. How do I do it? If it was for path I would have done something like:

QString curPath = dir.currentPath();

Not sure how to get the current working drive.

Upvotes: 0

Views: 1593

Answers (1)

ajshort
ajshort

Reputation: 3754

The QStorageInfo class provides information about a drive - to get one for a directory:

QStorageInfo info(dir);
qDebug() << "Name: " << info.name();
qDebug() << "Root path: " << info.rootPath();

Upvotes: 3

Related Questions