LYXERR(Debug::GRAPHICS, "\tthe orig file is: " << orig_file);
if (from == to) {
- if (!runparams.nice && getExtension(temp_file.absFilename()) != ext) {
+ if (!runparams.nice && !FileName(temp_file).hasExtension(ext)) {
// The LaTeX compiler will not be able to determine
// the file format from the extension, so we must
// change it.
#endif
}
+
+ static
+ bool isFilesystemEqual(QString const & lhs, QString const & rhs)
+ {
+ return QString::compare(lhs, rhs, os::isFilesystemCaseSensitive() ?
+ Qt::CaseSensitive : Qt::CaseInsensitive) == 0;
+ }
+
///
QFileInfo fi;
};
}
+bool FileName::hasExtension(const string & ext)
+{
+ return Private::isFilesystemEqual(d->fi.suffix(), toqstr(ext));
+}
+
+
FileName FileName::onlyPath() const
{
FileName path;
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);
std::string onlyFileNameWithoutExt() const;
/// only extension after the last dot.
std::string extension() const;
+ /** checks if the file has the given extension
+ on Windows and Mac it compares case insensitive */
+ bool hasExtension(const std::string & ext);
/// path without file name
FileName onlyPath() const;
/// used for display in the Gui
/// Name of the python interpreter
std::string const python();
+///
+bool isFilesystemCaseSensitive();
+
/// Extract the path common to both @c p1 and @c p2. DBCS aware!
/// \p p1, \p p2 and the return value are encoded in utf8.
std::size_t common_path(docstring const & p1, docstring const & p2);
}
+bool isFilesystemCaseSensitive()
+{
+ // FIXME: is this correct?
+ return true;
+}
+
+
docstring::size_type common_path(docstring const & p1, docstring const & p2)
{
docstring::size_type i = 0;
}
+bool isFilesystemCaseSensitive()
+{
+#ifdef __APPLE__
+ return false:
+#else
+ return true;
+#endif
+}
+
+
docstring::size_type common_path(docstring const & p1, docstring const & p2)
{
docstring::size_type i = 0;
}
+bool isFilesystemCaseSensitive()
+{
+ return false;
+}
+
+
docstring::size_type common_path(docstring const & p1, docstring const & p2)
{
size_t i = 0;