Truncate temporary file names that are too long for MikTeX's pdflatex

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@13388 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-03-16 12:19:55 +00:00
parent 5bd1399946
commit 01dd14b592
3 changed files with 22 additions and 11 deletions

View 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-02-12 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* package.C.in (relative_system_support_dir): fix for win32 and

View 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 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);
}
// 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);
}
}

View File

@ -31,6 +31,8 @@ What's new
- Translate \verb commands correctly in tex2lyx (bug 2236).
- Truncate temporary file names that are too long for MikTeX's pdflatex
* User Interface:
- Convert line endings for external copy/paste on OS X (bug 1955).