-1

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?

Waqar
  • 8,558
  • 4
  • 35
  • 43
night-wolf
  • 127
  • 9

1 Answers1

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