]> git.lyx.org Git - features.git/commitdiff
truncate too long filenames for pdflatex
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Wed, 15 Mar 2006 21:00:15 +0000 (21:00 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Wed, 15 Mar 2006 21:00:15 +0000 (21:00 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13384 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/ChangeLog
src/support/filename.C

index b7e95be7fe70bbc980793fd0e4cae390c7a6a4f8..fc5e55de2505daebdee5d5a9b3d25d9e3dc04982 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-15  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
+
+       * filename.C (mangledFilename): truncate filename to 140 characters
+       for MiKTeX's pdflatex
+
 2006-03-07  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * debugstream.h: fix nullstream.hpp location for boost 1.33.0
index 3019db3d80aa85b7f266bfe7cfeff7d6751bee46..15e2df333137af0ad3b837a9f0a4778dac618e69 100644 (file)
@@ -104,21 +104,25 @@ string const FileName::mangledFilename(std::string const & dir) const
        // This string contains about 50 chars-worth of other data,
        // leaving us, say, 160 characters for the file name itself.
        // (Erring on the side of caution.)
-       string::size_type max_length = 160;
+       // Other experiments show that MiKTeX's pdflatex compiler is even
+       // more picky. A maximum length of 140 has been proven to work.
+       string::size_type max_length = 140;
        if (dir.size() - 1 < max_length) {
-               // If dir.size() > max_length, all bets are off anyway.
                // "+ 1" for the directory separator.
                max_length -= dir.size() + 1;
-
-               // If the mangled file name is too long, hack it to fit.
-               // We know we're guaranteed to have a unique file name because
-               // of the counter.
-               if (mname.size() > max_length) {
-                       int const half = (int(max_length) / 2) - 2;
-                       if (half > 0) {
-                               mname = mname.substr(0, half) + "___" +
-                                       mname.substr(mname.size() - half);
-                       }
+       }
+       // If dir.size() > max_length, all bets are off for YAP anyway.
+       // We truncate the filename nevertheless because of MiKTeX's
+       // pdflatex compiler.
+
+       // If the mangled file name is too long, hack it to fit.
+       // We know we're guaranteed to have a unique file name because
+       // of the counter.
+       if (mname.size() > max_length) {
+               int const half = (int(max_length) / 2) - 2;
+               if (half > 0) {
+                       mname = mname.substr(0, half) + "___" +
+                               mname.substr(mname.size() - half);
                }
        }