#include "support/filetools.h"
-#include "support/convert.h"
#include "support/debug.h"
#include "support/environment.h"
#include "support/gettext.h"
using namespace std;
+#define USE_QPROCESS
+
namespace lyx {
namespace support {
// filenames to child processes if possible. We store them in
// a python script instead, where we don't have these
// limitations.
+#ifndef USE_QPROCESS
return (os::shell() == os::UNIX) ?
'\'' + name + '\'':
'"' + name + '"';
+#else
+ return '"' + name + '"';
+#endif
case quote_python:
return "\"" + subst(subst(name, "\\", "\\\\"), "\"", "\\\"")
+ "\"";
// FIXME It might be nice if the code didn't simply assume that.
FileName const makeAbsPath(string const & relPath, string const & basePath)
{
- FileName relative_path(relPath);
// checks for already absolute path
- if (relative_path.isAbsolute())
- return relative_path;
+ if (FileName::isAbsolute(relPath))
+ return FileName(relPath);
// Copies given paths
string tempRel = os::internal_path(relPath);
string tempBase;
- FileName base_path(basePath);
- if (base_path.isAbsolute())
+ if (FileName::isAbsolute(basePath))
tempBase = basePath;
else
tempBase = addPath(FileName::getcwd().absFilename(), basePath);
{
// checks for already absolute path
string rTemp = replaceEnvironmentPath(path);
- FileName abs_path(rTemp);
- if (abs_path.isAbsolute())
+ if (FileName::isAbsolute(rTemp))
return rTemp;
string temp;
static boost::regex envvar_br_re("(.*)" + envvar_br + "(.*)");
static boost::regex envvar_re("(.*)" + envvar + "(.*)");
boost::smatch what;
-
- string result = path;
+ string result;
+ string remaining = path;
while (1) {
- regex_match(result, what, envvar_br_re);
+ regex_match(remaining, what, envvar_br_re);
if (!what[0].matched) {
- regex_match(result, what, envvar_re);
- if (!what[0].matched)
+ regex_match(remaining, what, envvar_re);
+ if (!what[0].matched) {
+ result += remaining;
break;
+ }
}
- result = what.str(1) + getEnv(what.str(2)) + what.str(3);
+ string env_var = getEnv(what.str(2));
+ if (!env_var.empty())
+ result += what.str(1) + env_var;
+ else
+ result += what.str(1) + "$" + what.str(2);
+ remaining = what.str(3);
}
return result;
}
}
-void removeAutosaveFile(string const & filename)
-{
- string a = onlyPath(filename);
- a += '#';
- a += onlyFilename(filename);
- a += '#';
- FileName const autosave(a);
- if (autosave.exists())
- autosave.removeFile();
-}
-
-
void readBB_lyxerrMessage(FileName const & file, bool & zipped,
string const & message)
{