[Qt-interest] QFile::exists on a folder
Mika Rajala
mika_rajala_2 at hotmail.com
Thu Feb 11 11:14:19 CET 2010
Ok, that's nice.
Much less kludgy than my current solution.
But I still wonder why QFile::exists would return true on a directory and if it's intentional or a bug?
-mika
> From: erelender at yahoo.com
> Date: Thu, 11 Feb 2010 11:48:17 +0200
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QFile::exists on a folder
>
> You can use QFileInfo to distinguish between dirs and files.
>
> void myClass::openFile(const QString & _file)
> {
> QFileInfo fileInfo(_file);
> if(fileInfo.isFile())
> {
> QFile fileToOpen(_file);
> if(fileToOpen.exists() == false)
> {
> printf("Error file:\"%s\" doesn't exist",
> _file.toStdString().c_str());
> }
> ....
> }
> }
>
> --
> Ender EREL
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
_________________________________________________________________
Uudessa IE8 selaimessa on uudet pikatoiminnot.
http://www.microsoft.com/finland/windows/products/winfamily/ie/beta/default.mspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100211/fe6af836/attachment.html
More information about the Qt-interest-old
mailing list