[Qt-interest] QFileInfo returning wrong value in != operator
Atlant Schmidt
aschmidt at dekaresearch.com
Wed Aug 17 19:21:54 CEST 2011
Eric, et al.:
> This may have confused me a little, but doesn’t the absolute path always resolve any . or ..?
I'm pretty sure that a path like this:
/first_level_directory/second_level_directory/../../other_fld/other_sld/other_target_file
is still an "absolute" path since it starts at the root.
Meanwhile, it certainly contains "..".
"./" can also be freely introduced anywhere so:
/first_level_directory/./././././second_level_directory/target_file
is also a valid absolute path.
Whether your software will ever see such a path depends
on factors such as "is this user input?" and "how perverse
is your human user?" or "how much grief will scripts give you?".
Atlant
-----Original Message-----
From: qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com [mailto:qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com] On Behalf Of Eric Clark
Sent: Wednesday, August 17, 2011 12:05
To: Qt Interest (qt-interest at trolltech.com)
Subject: Re: [Qt-interest] QFileInfo returning wrong value in != operator
> -----Original Message-----
> From: Scott Aron Bloom [mailto:Scott.Bloom at onshorecs.com]
> Sent: Monday, August 15, 2011 9:03 PM
> To: Jason H; Eric Clark; qt-interest at trolltech.com
> Subject: RE: [Qt-interest] QFileInfo returning wrong value in != operator
>
> I have used it with success, except I check for exists.. and if it doesn’t, I just
> compare the absolute paths directly
>
> Which would fail in the situation where there are .. and . in the path Scott
Scott,
This may have confused me a little, but doesn’t the absolute path always resolve any . or ..?
Thanks,
Eric
>
>
> -----Original Message-----
> From: Jason H [mailto:scorp1us at yahoo.com]
> Sent: Monday, August 15, 2011 2:02 PM
> To: Scott Aron Bloom; Eric Clark; qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QFileInfo returning wrong value in != operator
>
> Should probably use a Null string and isNull() instead of isEmpty().
>
> You want a relational database-style null, where a null is not equal to all other
> nulls. It's probably too late to change canonicalPath to return a isNull()able
> null string, comparing first the nulls, then looking at string contents. I wonder
> how the self-tests fare...
>
> But in other news, I think we have a situation where a non-existent file is the
> same as all other non-existent files... Which does kind-of make sense.
>
> But it seems as if QFileInfo::operator== () is pretty broken anyway.
>
> ________________________________
> From: Scott Aron Bloom <Scott.Bloom at onshorecs.com>
> To: Eric Clark <eclark at ara.com>; qt-interest at trolltech.com
> Sent: Monday, August 15, 2011 4:43 PM
> Subject: Re: [Qt-interest] QFileInfo returning wrong value in != operator
>
>
> I believe there is a bug on this, (or there was that I filed years ago)
>
> It stems from the fact that operator == (and !=) use (or used to)
> canonicalPath, which returns empty string if the file does not exist
>
> My bug suggeste it be documented that the results are unknown if the files
> don’t exist
>
> Scott
>
> From:qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com
> [mailto:qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com]
> On Behalf Of Eric Clark
> Sent: Monday, August 15, 2011 12:09 PM
> To: Qt Interest (qt-interest at trolltech.com)
> Subject: [Qt-interest] QFileInfo returning wrong value in != operator
>
> Hello All,
>
> I am currently using Qt 4.7.1 and I am running into a problem with QFileInfo. I
> have two instances of QFileInfo and they both point to different files.
> However, the == operator keeps saying they are the same. Here is the exact
> paths of the two files:
>
> 1. C:/Users/eclark/EndgameFramework/FourStoryDemo.db
> 2. C:/Users/eclark/EndgameFramework/test.db
>
> The two files are clearly different. However, QFileInfo keeps saying they are
> the same. The only thing I could see that may be a problem is the fact that
> the files do not exist yet. Does the == operator check for existence? Does
> anyone know why this would be happening?
>
> Thanks in Advance!
> Eric
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.
Thank you.
Please consider the environment before printing this email.
More information about the Qt-interest-old
mailing list