]> git.lyx.org Git - features.git/commitdiff
Fix bug 2235: jpeg capital letters (.JPG) does not work with pdflatex
authorPeter Kümmel <syntheticpp@gmx.net>
Sun, 5 Oct 2008 11:51:18 +0000 (11:51 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Sun, 5 Oct 2008 11:51:18 +0000 (11:51 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26744 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetGraphics.cpp
src/support/FileName.cpp
src/support/FileName.h
src/support/os.h
src/support/os_cygwin.cpp
src/support/os_unix.cpp
src/support/os_win32.cpp

index f7c55eab2f3782a298511f6ab9904d5d77b940af..28ea68f7d110c627257cfff1582e284941224239 100644 (file)
@@ -668,7 +668,7 @@ string InsetGraphics::prepareFile(OutputParams const & runparams) const
        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.
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);
index 1c020c898f18d7e8760907d7bd3c870129ac2354..26d0179d1919fb5bcd00be03e184f13d567d379a 100644 (file)
@@ -174,6 +174,9 @@ public:
        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
index 2d41dd76267a6d2f377ed44c55de3a01ab455453..35fa2aa6132b0522b2c4d226aff0453244452fce 100644 (file)
@@ -42,6 +42,9 @@ shell_type shell();
 /// 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);
index f13d25c37b38b82751b4e7f8a2b0b1da1217da16..032aae7f131b46962129a7d68f39f8d1b9157d42 100644 (file)
@@ -138,6 +138,13 @@ string current_root()
 }
 
 
+bool isFilesystemCaseSensitive()
+{
+       // FIXME: is this correct?
+       return true;
+}
+
+
 docstring::size_type common_path(docstring const & p1, docstring const & p2)
 {
        docstring::size_type i = 0;
index 50701eaeb13b0c17539c2fc64f2bd50348949c24..4c774fc82b9737f86b1c3b583379149fd975fd7b 100644 (file)
@@ -36,6 +36,16 @@ string current_root()
 }
 
 
+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;
index 1522486704f7ed9b71330baf16b961dbf3263542..fe7878a16f994c6d286cac1a80a40333c248f979 100644 (file)
@@ -172,6 +172,12 @@ string current_root()
 }
 
 
+bool isFilesystemCaseSensitive()
+{
+       return false;
+}
+
+
 docstring::size_type common_path(docstring const & p1, docstring const & p2)
 {
        size_t i = 0;