#include "debug.h"
#include "lyxtextclass.h"
+
+#include "support/convert.h"
#include "support/filetools.h"
+#include "support/fs_extras.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
#include "support/os.h"
#include "support/package.h"
#include <boost/function.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
#include <cctype>
#include <fstream>
using lyx::support::isStrUnsignedInt;
using lyx::support::ltrim;
using lyx::support::rtrim;
-using lyx::support::strToUnsignedInt;
using lyx::support::IsFileReadable;
-using lyx::support::IsFileWriteable;
+
+namespace fs = boost::filesystem;
+
// Hacks to allow the thing to link in the lyxlayout stuff
LyXErr lyxerr(std::cerr.rdbuf());
// definition o1 o2 invocation result
// \newcommand{\foo}{bar} "" false \foo bar
// \newcommand{\foo}[1]{bar #1} "[1]" false \foo{x} bar x
- // \newcommand{\foo}[1][]{bar #1} "[1]" true \foo bar
+ // \newcommand{\foo}[1][]{bar #1} "[1]" true \foo bar
// \newcommand{\foo}[1][]{bar #1} "[1]" true \foo[x] bar x
// \newcommand{\foo}[1][x]{bar #1} "[1]" true \foo[x] bar x
unsigned int nargs = 0;
string const opt1 = rtrim(ltrim(o1, "["), "]");
if (isStrUnsignedInt(opt1)) {
// The command has arguments
- nargs = strToUnsignedInt(opt1);
+ nargs = convert<unsigned int>(opt1);
if (nargs > 0 && o2) {
// The first argument is optional
arguments.push_back(optional);
bool tex2lyx(string const &infilename, string const &outfilename)
{
- if (!(IsFileReadable(infilename) && IsFileWriteable(outfilename))) {
+ if (!(IsFileReadable(infilename) && fs::is_writable(outfilename))) {
return false;
}
if (!overwrite_files && IsFileReadable(outfilename)) {
int main(int argc, char * argv[])
{
+ fs::path::default_name_check(fs::no_check);
+
easyParse(argc, argv);
if (argc <= 1) {
}
lyx::support::os::init(argc, argv);
- lyx::support::init_package(argv[0], cl_system_support, cl_user_support);
+ lyx::support::init_package(argv[0], cl_system_support, cl_user_support,
+ lyx::support::top_build_dir_is_two_levels_up);
string const system_syntaxfile = lyx::support::LibFileSearch("reLyX", "syntax.default");
if (system_syntaxfile.empty()) {