Andre Poenitz wrote:
On Sat, Oct 04, 2008 at 07:30:46PM +0200, Peter Kümmel wrote:
Here a patch for
http://bugzilla.lyx.org/show_bug.cgi?id=2235

Is there a better way to detect case sensitiveness
of the file actual system?

I don't know, but Mac's file system seems to be case-insensitive as well.
Also, instead of toLower(), QString::compare(..., Qt::CaseInsensitive)
seems preferable.

Are the filenames simply utf8 encoded?

--
Peter Kümmel
Index: insets/InsetGraphics.cpp
===================================================================
--- insets/InsetGraphics.cpp    (revision 26731)
+++ insets/InsetGraphics.cpp    (working copy)
@@ -668,7 +668,8 @@
        LYXERR(Debug::GRAPHICS, "\tthe orig file is: " << orig_file);
 
        if (from == to) {
-               if (!runparams.nice && getExtension(temp_file.absFilename()) != 
ext) {
+               if (!runparams.nice && !isFilesystemEqual(
+                                               
getExtension(temp_file.absFilename()), ext)) {
                        // The LaTeX compiler will not be able to determine
                        // the file format from the extension, so we must
                        // change it.
Index: support/filetools.cpp
===================================================================
--- support/filetools.cpp       (revision 26731)
+++ support/filetools.cpp       (working copy)
@@ -608,6 +608,17 @@
 }
 
 
+bool isFilesystemEqual(string const & lhs, string const & rhs)
+{
+#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
+       return QString::compare(toqstr(lhs), toqstr(rhs), 
+                                       Qt::CaseInsensitive) == 0;
+#else
+       return lhs == rhs;
+#endif
+}
+
+
 string const changeExtension(string const & oldname, string const & extension)
 {
        string::size_type const last_slash = oldname.rfind('/');
Index: support/filetools.h
===================================================================
--- support/filetools.h (revision 26731)
+++ support/filetools.h (working copy)
@@ -72,6 +72,12 @@
 ///
 bool isValidLaTeXFilename(std::string const & filename);
 
+/** compare strings case senstive only when the 
+    filesystem is case sensitive */
+bool isFilesystemEqual(std::string const & lhs, std::string const & rhs);
+
+
+
 /** Returns the path of a library data file.
     Search the file name.ext in the subdirectory dir of
       -# user_lyxdir

Reply via email to