X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftex2lyx%2Ftex2lyx.cpp;h=632acc6a7ae459626a4cdd3798024057bb8ca22e;hb=309c75046e71cc78f1968cff8ee10aaae1a62af7;hp=81afdaec6f03648678be8b3b2677d0c479df7ca6;hpb=04591a6e34a0ac52632f3a309df9ff375a91b713;p=lyx.git diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp index 81afdaec6f..632acc6a7a 100644 --- a/src/tex2lyx/tex2lyx.cpp +++ b/src/tex2lyx/tex2lyx.cpp @@ -16,7 +16,7 @@ #include "Context.h" #include "debug.h" -#include "LyXTextClass.h" +#include "TextClass.h" #include "support/convert.h" #include "support/filetools.h" @@ -25,7 +25,7 @@ #include "support/lyxlib.h" #include "support/ExceptionMessage.h" #include "support/os.h" -#include "support/package.h" +#include "support/Package.h" #include "support/unicode.h" #include @@ -62,11 +62,13 @@ using support::isStrUnsignedInt; using support::ltrim; using support::makeAbsPath; using support::onlyPath; +using support::os::internal_path; using support::rtrim; using support::isFileReadable; namespace fs = boost::filesystem; +LayoutPtr captionlayout; // Hacks to allow the thing to link in the lyxlayout stuff LyXErr lyxerr(std::cerr.rdbuf()); @@ -306,7 +308,7 @@ int parse_syntaxfile(string const & arg, string const &) cerr << "Missing syntaxfile string after -s switch" << endl; exit(1); } - syntaxfile = arg; + syntaxfile = internal_path(arg); return 1; } @@ -323,7 +325,7 @@ int parse_sysdir(string const & arg, string const &) cerr << "Missing directory for -sysdir switch" << endl; exit(1); } - cl_system_support = arg; + cl_system_support = internal_path(arg); return 1; } @@ -334,7 +336,7 @@ int parse_userdir(string const & arg, string const &) cerr << "Missing directory for -userdir switch" << endl; exit(1); } - cl_user_support = arg; + cl_user_support = internal_path(arg); return 1; } @@ -425,7 +427,8 @@ void tex2lyx(std::istream &is, std::ostream &os) //p.dump(); stringstream ss; - LyXTextClass textclass = parse_preamble(p, ss, documentclass); + TextClass textclass = parse_preamble(p, ss, documentclass); + captionlayout = LayoutPtr(Layout::forCaption()); active_environments.push_back("document"); Context context(true, textclass); @@ -512,7 +515,7 @@ int main(int argc, char * argv[]) lyx::support::os::init(argc, argv); - try { support::init_package(to_utf8(from_local8bit(argv[0])), + try { support::init_package(internal_path(to_utf8(from_local8bit(argv[0]))), cl_system_support, cl_user_support, support::top_build_dir_is_two_levels_up); } catch (support::ExceptionMessage const & message) { @@ -521,15 +524,17 @@ int main(int argc, char * argv[]) if (message.type_ == support::ErrorException) exit(1); } - + // Now every known option is parsed. Look for input and output // file name (the latter is optional). - string const infilename = makeAbsPath(to_utf8(from_local8bit(argv[1]))).absFilename(); + string infilename = internal_path(to_utf8(from_local8bit(argv[1]))); + infilename = makeAbsPath(infilename).absFilename(); + string outfilename; if (argc > 2) { - outfilename = to_utf8(from_local8bit(argv[2])); + outfilename = internal_path(to_utf8(from_local8bit(argv[2]))); if (outfilename != "-") - outfilename = makeAbsPath(to_utf8(from_local8bit(argv[2]))).absFilename(); + outfilename = makeAbsPath(outfilename).absFilename(); } else outfilename = changeExtension(infilename, ".lyx");