[Solved]QFile::exists return true when i choose folder
-
You may want to use "QFileInfo":http://developer.qt.nokia.com/doc/qt-4.8/qfileinfo.html#exists instead.
There you can check whether it is a file or directory/folder. -
Because there are many different file systems, and in some of the ones used on Linux for instance a directory is a file.
[quote]A Linux system, just like UNIX, makes no difference between a file and a directory, since a directory is just a file containing names of other files. Programs, services, texts, images, and so forth, are all files. Input and output devices, and generally all devices, are considered to be files, according to the system.[/quote]
(from http://tldp.org/LDP/intro-linux/html/sect_03_01.html )