DocFileName::DocFileName(string const & abs_filename, bool save_abs)
- : FileName(abs_filename), save_abs_path_(save_abs), zipped_valid_(false)
+ : FileName(abs_filename), save_abs_path_(save_abs)
{}
DocFileName::DocFileName(FileName const & abs_filename, bool save_abs)
- : FileName(abs_filename), save_abs_path_(save_abs), zipped_valid_(false)
+ : FileName(abs_filename), save_abs_path_(save_abs)
{}
FileName::set(name);
else
FileName::set(makeAbsPath(name, buffer_path).absFileName());
- zipped_valid_ = false;
}
void DocFileName::erase()
{
FileName::erase();
- zipped_valid_ = false;
}
}
-bool DocFileName::isZipped() const
-{
- if (!zipped_valid_) {
- zipped_ = isZippedFile();
- zipped_valid_ = true;
- }
- return zipped_;
-}
-
-
string DocFileName::unzippedFileName() const
{
return support::unzippedFileName(absFileName());
std::string
mangledFileName(std::string const & dir = empty_string()) const;
- /// \return true if the file is compressed.
- bool isZipped() const;
/// \return the absolute file name without its .gz, .z, .Z extension
std::string unzippedFileName() const;
/// Records whether we should save (or export) the filename as a relative
/// or absolute path.
bool save_abs_path_;
- /// Cache for isZipped() because zippedFile() is expensive
- mutable bool zipped_;
- /// Is zipped_ valid?
- mutable bool zipped_valid_;
};
}
-void readBB_lyxerrMessage(FileName const & file, bool & zipped,
- string const & message)
-{
- LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] " << message);
- // FIXME: Why is this func deleting a file? (Lgb)
- if (zipped)
- file.removeFile();
-}
-
-
string const readBB_from_PSFile(FileName const & file)
{
// in a (e)ps-file it's an entry like %%BoundingBox:23 45 321 345
string const format = file_.guessFormatFromContents();
if (format != "eps" && format != "ps") {
- readBB_lyxerrMessage(file_, zipped,"no(e)ps-format");
+ LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] no(e)ps-format");
+ if (zipped)
+ file_.removeFile();
return string();
}
os << what.str(1) << ' ' << what.str(2) << ' '
<< what.str(3) << ' ' << what.str(4);
string const bb = os.str();
- readBB_lyxerrMessage(file_, zipped, bb);
+ LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] " << bb);
+ if (zipped)
+ file_.removeFile();
return bb;
}
}
- readBB_lyxerrMessage(file_, zipped, "no bb found");
+ LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] no bb found");
+ if (zipped)
+ file_.removeFile();
return string();
}