I wanted to specify from a path, whether the item is a file or a folder. How can I implement such function which takes a path (QString
based input) and tells whether it is a file or folder?
Asked
Active
Viewed 1,233 times
1 Answers
5
You can use the method QFileInfo::isFile()
or QFileInfo::isDir()
to accomplish this.
Example:
QFileInfo fi("/your/path/string");
if (fi.exists() && fi.isFile())
{
//Do stuff...
}

Frank Osterfeld
- 24,815
- 5
- 58
- 70

Waqar
- 8,558
- 4
- 35
- 43