#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lstrings.h"
+#include "support/mutex.h"
#include "support/os.h"
#include "support/PathChanger.h"
#include "support/Systemcall.h"
string format;
bool firstLine = true;
bool backslash = false;
+ bool maybelatex = false;
int dollars = 0;
- while ((count++ < max_count) && format.empty()) {
+ while ((count++ < max_count) && format.empty() && !maybelatex) {
if (ifs.eof())
break;
contains(str, "$$") ||
contains(str, "\\[") ||
contains(str, "\\]"))
- format = "latex";
+ maybelatex = true;
else {
if (contains(str, '\\'))
backslash = true;
dollars += count_char(str, '$');
+ if (backslash && dollars > 1)
+ // inline equation
+ maybelatex = true;
}
}
- if (format.empty() && backslash && dollars > 1)
- // inline equation
+ if (format.empty() && maybelatex && !isBinaryFile(fn))
format = "latex";
if (format.empty()) {
};
-// FIXME THREAD
/// Mapping absolute pathnames of files to their ZippedInfo metadata.
static std::map<std::string, ZippedInfo> zipped_;
+static Mutex zipped_mutex;
bool Formats::isZippedFile(support::FileName const & filename) const {
string const & fname = filename.absFileName();
time_t timestamp = filename.lastModified();
+ Mutex::Locker lock(&zipped_mutex);
map<string, ZippedInfo>::iterator it = zipped_.find(fname);
if (it != zipped_.end() && it->second.timestamp == timestamp)
return it->second.zipped;