[Qt-interest] QFile::exists on a folder

Mika Rajala mika_rajala_2 at hotmail.com
Thu Feb 11 10:30:14 CET 2010


Hi

 

Am I doing something wrong.

 

I want to check if a file exists prior to opening it, and I do something like this:

 

void myClass::openFile(const QString & _file)

{

  QFile fileToOpen(_file);

  if(fileToOpen.exists() == false)

  {

     printf("Error file:\"%s\" doesn't exist", _file.toStdString().c_str());

  }

   ....

}

 

It all works fine, until that function is called with an absolute path to a directory.

 

How do i check that the path given exists and it doesn't point to a directory.

 

There the QFile::exists returns true, for some unfathomable reason.

 

-mika
 		 	   		  
_________________________________________________________________
Tutustu videoiden avulla Windows Live tuotteisiin.
http://www.microsoft.fi/live
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100211/21a4a42c/attachment.html 


More information about the Qt-interest-old mailing list