]> git.lyx.org Git - features.git/blobdiff - src/support/FileName.cpp
Fix bug 2235: jpeg capital letters (.JPG) does not work with pdflatex
[features.git] / src / support / FileName.cpp
index f101bba8925ea2354f11cd1e107514f4fb286a03..8e51a4a92eb212f0de8d054250fc5ac43235ca2d 100644 (file)
@@ -121,6 +121,14 @@ struct FileName::Private
 #endif
        }
 
+
+       static
+       bool isFilesystemEqual(QString const & lhs, QString const & rhs)
+       {
+               return QString::compare(lhs, rhs, os::isFilesystemCaseSensitive() ?
+                       Qt::CaseSensitive : Qt::CaseInsensitive) == 0;
+       }
+
        ///
        QFileInfo fi;
 };
@@ -323,6 +331,12 @@ string FileName::extension() const
 }
 
 
+bool FileName::hasExtension(const string & ext)
+{
+       return Private::isFilesystemEqual(d->fi.suffix(), toqstr(ext));
+}
+
+
 FileName FileName::onlyPath() const
 {
        FileName path;
@@ -920,8 +934,10 @@ bool operator==(FileName const & lhs, FileName const & rhs)
        lhs.d->refresh();
        rhs.d->refresh();
        
-       if (!lhs.d->fi.isSymLink() && !rhs.d->fi.isSymLink())
+       if (!lhs.d->fi.isSymLink() && !rhs.d->fi.isSymLink()) {
+               // Qt already checks if the filesystem is case sensitive or not.
                return lhs.d->fi == rhs.d->fi;
+       }
 
        // FIXME: When/if QFileInfo support symlink comparison, remove this code.
        QFileInfo fi1(lhs.d->fi);