[Interest] Detecting subdirectories in QDir

Thiago Macieira thiago.macieira at intel.com
Wed Jul 11 20:05:40 CEST 2018


On Wednesday, 11 July 2018 07:59:28 PDT Thiago Macieira wrote:
> On Wednesday, 11 July 2018 07:44:46 PDT Oleg Yadrov wrote:
> >     qDebug() << a.absolutePath().startsWith(b.absolutePath());
> >     
> >     qDebug() << a.absolutePath().startsWith(c.absolutePath());
> 
> Except that this has a bug (which we had in Qt too): these two directories
> are considered to be parent-child, when they're not
> 
> 	C:\One\TwoAndTwenty
> 	C:\One\Two
> 
> And since we're talking about Windows, you also need to use case-insensitive
> comparison.

Because of these gotchas, it's probably worth having a QDir::isParentOf() 
function.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center






More information about the Interest mailing list