#include <QDir>
#include "support/lassert.h"
-#include <boost/regex.hpp>
+#include "support/regex.h"
#include <fcntl.h>
bool isValidLaTeXFileName(string const & filename)
{
- string const invalid_chars("#$%{}()[]\"^");
+ string const invalid_chars("#%\"");
+ return filename.find_first_of(invalid_chars) == string::npos;
+}
+
+
+bool isValidDVIFileName(string const & filename)
+{
+ string const invalid_chars("${}()[]^");
return filename.find_first_of(invalid_chars) == string::npos;
}
if (deflt.empty() || deflt == package().system_temp_dir())
return createTmpDir(package().system_temp_dir(), "lyx_tmpdir");
- if (deflt.createDirectory(0777))
+ if (deflt.createDirectory(0777))
return deflt;
if (deflt.isDirWritable()) {
// $\{[A-Za-z_][A-Za-z_0-9]*\}
static string const envvar = "[$]([A-Za-z_][A-Za-z_0-9]*)";
- static boost::regex envvar_br_re("(.*)" + envvar_br + "(.*)");
- static boost::regex envvar_re("(.*)" + envvar + "(.*)");
- boost::smatch what;
+ static regex envvar_br_re("(.*)" + envvar_br + "(.*)");
+ static regex envvar_re("(.*)" + envvar + "(.*)");
+ smatch what;
string result;
string remaining = path;
while (1) {
}
+#ifdef HAVE_READLINK
bool readLink(FileName const & file, FileName & link)
{
-#ifdef HAVE_READLINK
char linkbuffer[PATH_MAX + 1];
string const encoded = file.toFilesystemEncoding();
int const nRead = ::readlink(encoded.c_str(),
linkbuffer[nRead] = '\0'; // terminator
link = makeAbsPath(linkbuffer, onlyPath(file.absFileName()));
return true;
+}
#else
+bool readLink(FileName const &, FileName &)
+{
return false;
-#endif
}
+#endif
cmd_ret const runCommand(string const & cmd)
// variants ipstream, opstream
#if defined (_WIN32)
- int fno;
- STARTUPINFO startup;
- PROCESS_INFORMATION process;
- SECURITY_ATTRIBUTES security;
+ int fno;
+ STARTUPINFO startup;
+ PROCESS_INFORMATION process;
+ SECURITY_ATTRIBUTES security;
HANDLE in, out;
FILE * inf = 0;
-
- security.nLength = sizeof(SECURITY_ATTRIBUTES);
- security.bInheritHandle = TRUE;
- security.lpSecurityDescriptor = NULL;
- if (CreatePipe(&in, &out, &security, 0)) {
+ security.nLength = sizeof(SECURITY_ATTRIBUTES);
+ security.bInheritHandle = TRUE;
+ security.lpSecurityDescriptor = NULL;
+
+ if (CreatePipe(&in, &out, &security, 0)) {
memset(&startup, 0, sizeof(STARTUPINFO));
memset(&process, 0, sizeof(PROCESS_INFORMATION));
-
+
startup.cb = sizeof(STARTUPINFO);
startup.dwFlags = STARTF_USESTDHANDLES;
-
+
startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);
startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
startup.hStdOutput = out;
return string();
}
- static boost::regex bbox_re(
+ static lyx::regex bbox_re(
"^%%BoundingBox:\\s*([[:digit:]]+)\\s+([[:digit:]]+)\\s+([[:digit:]]+)\\s+([[:digit:]]+)");
ifstream is(file_.toFilesystemEncoding().c_str());
while (is) {
string s;
getline(is,s);
- boost::smatch what;
+ lyx::smatch what;
if (regex_match(s, what, bbox_re)) {
// Our callers expect the tokens in the string
// separated by single spaces.