mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-04 08:37:52 +00:00
Enable tex2lyx to run in-place.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9562 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b246ba02fd
commit
23d9c229e3
src
@ -1,3 +1,8 @@
|
||||
2005-01-31 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx_main.C (priv_exec): specify explicitly the relative location
|
||||
of the top level build directory when run in-place.
|
||||
|
||||
2005-01-27 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* BufferView_pimpl.C (MenuInsertLyXFile): do breakParagraph on the
|
||||
|
@ -205,7 +205,8 @@ void LyX::priv_exec(int & argc, char * argv[])
|
||||
// we need to parse for "-dbg" and "-help"
|
||||
bool const want_gui = easyParse(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_one_level_up);
|
||||
|
||||
if (want_gui)
|
||||
lyx_gui::parse_init(argc, argv);
|
||||
|
@ -1,3 +1,9 @@
|
||||
2005-01-31 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* package.[Ch] (init_package, c-tor): define and use an enum to
|
||||
specify explicitly the location of the top level build directory
|
||||
when the executable is run in-place.
|
||||
|
||||
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
|
||||
* fs_extras.C: add changes from Asgers Win32 patch.
|
||||
|
@ -66,7 +66,8 @@ bool initialised_ = false;
|
||||
|
||||
void init_package(string const & command_line_arg0,
|
||||
string const & command_line_system_support_dir,
|
||||
string const & command_line_user_support_dir)
|
||||
string const & command_line_user_support_dir,
|
||||
exe_build_dir_to_top_build_dir top_build_dir_location)
|
||||
{
|
||||
// Can do so only once.
|
||||
if (initialised_)
|
||||
@ -74,7 +75,8 @@ void init_package(string const & command_line_arg0,
|
||||
|
||||
package_ = Package(command_line_arg0,
|
||||
command_line_system_support_dir,
|
||||
command_line_user_support_dir);
|
||||
command_line_user_support_dir,
|
||||
top_build_dir_location);
|
||||
initialised_ = true;
|
||||
}
|
||||
|
||||
@ -93,7 +95,9 @@ namespace {
|
||||
|
||||
string const abs_path_from_binary_name(string const & exe);
|
||||
|
||||
std::pair<string, string> const get_build_dirs(string const & abs_binary);
|
||||
std::pair<string, string> const
|
||||
get_build_dirs(string const & abs_binary,
|
||||
exe_build_dir_to_top_build_dir top_build_dir_location);
|
||||
|
||||
string const get_document_dir(string const & home_dir);
|
||||
|
||||
@ -117,7 +121,8 @@ get_user_support_dir(string const & default_user_support_dir,
|
||||
|
||||
Package::Package(string const & command_line_arg0,
|
||||
string const & command_line_system_support_dir,
|
||||
string const & command_line_user_support_dir)
|
||||
string const & command_line_user_support_dir,
|
||||
exe_build_dir_to_top_build_dir top_build_dir_location)
|
||||
: explicit_user_support_dir_(false)
|
||||
{
|
||||
home_dir_ = get_home_dir();
|
||||
@ -129,7 +134,7 @@ Package::Package(string const & command_line_arg0,
|
||||
|
||||
// Is LyX being run in-place from the build tree?
|
||||
boost::tie(build_support_dir_, system_support_dir_) =
|
||||
get_build_dirs(abs_binary);
|
||||
get_build_dirs(abs_binary, top_build_dir_location);
|
||||
|
||||
if (build_support_dir_.empty())
|
||||
system_support_dir_ =
|
||||
@ -224,7 +229,27 @@ string const win32_folder_path(int folder_id)
|
||||
#endif
|
||||
|
||||
|
||||
std::pair<string, string> const get_build_dirs(string const & abs_binary)
|
||||
std::string const
|
||||
get_build_support_dir(std::string const & binary_dir,
|
||||
exe_build_dir_to_top_build_dir top_build_dir_location)
|
||||
{
|
||||
string indirection;
|
||||
switch (top_build_dir_location) {
|
||||
case top_build_dir_is_one_level_up:
|
||||
indirection = "../lib";
|
||||
break;
|
||||
case top_build_dir_is_two_levels_up:
|
||||
indirection = "../../lib";
|
||||
break;
|
||||
}
|
||||
|
||||
return NormalizePath(AddPath(binary_dir, indirection));
|
||||
}
|
||||
|
||||
|
||||
std::pair<string, string> const
|
||||
get_build_dirs(string const & abs_binary,
|
||||
exe_build_dir_to_top_build_dir top_build_dir_location)
|
||||
{
|
||||
string const check_text = "Checking whether LyX is run in place...";
|
||||
|
||||
@ -241,7 +266,7 @@ std::pair<string, string> const get_build_dirs(string const & abs_binary)
|
||||
// Try and find "lyxrc.defaults".
|
||||
string const binary_dir = OnlyPath(binary);
|
||||
string const build_support_dir =
|
||||
NormalizePath(AddPath(binary_dir, "../lib"));
|
||||
get_build_support_dir(binary_dir, top_build_dir_location);
|
||||
|
||||
if (!FileSearch(build_support_dir, "lyxrc.defaults").empty()) {
|
||||
// Try and find "chkconfig.ltx".
|
||||
|
@ -22,6 +22,16 @@ namespace support {
|
||||
|
||||
class Package;
|
||||
|
||||
/** When run in-place <build-dir>/src/lyx is one level up from
|
||||
* the <build-dir> whilst <build-dir>/src/tex2lyx/tex2lyx is
|
||||
* two levels up.
|
||||
*/
|
||||
enum exe_build_dir_to_top_build_dir {
|
||||
top_build_dir_is_one_level_up,
|
||||
top_build_dir_is_two_levels_up
|
||||
};
|
||||
|
||||
|
||||
/** Initialise package() with the command line data.
|
||||
* This data is exactly as it was passed in the argv[] array.
|
||||
*
|
||||
@ -36,7 +46,8 @@ class Package;
|
||||
*/
|
||||
void init_package(std::string const & command_line_arg0,
|
||||
std::string const & command_line_system_support_dir,
|
||||
std::string const & command_line_user_support_dir);
|
||||
std::string const & command_line_user_support_dir,
|
||||
exe_build_dir_to_top_build_dir);
|
||||
|
||||
/** Accessor to the global data.
|
||||
* Asserts that init_package() has been called first.
|
||||
@ -53,7 +64,8 @@ public:
|
||||
*/
|
||||
Package(std::string const & command_line_arg0,
|
||||
std::string const & command_line_system_support_dir,
|
||||
std::string const & command_line_user_support_dir);
|
||||
std::string const & command_line_user_support_dir,
|
||||
exe_build_dir_to_top_build_dir);
|
||||
|
||||
/** The directory containing the LyX executable.
|
||||
*/
|
||||
|
@ -1,3 +1,10 @@
|
||||
2005-01-31 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* tex2lyx.C (main): enable tex2lyx to find the top level
|
||||
build directory when run in-place.
|
||||
|
||||
Also add "fs::path::default_name_check(fs::no_check);"
|
||||
|
||||
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
|
||||
* tex2lyx.C: rewrite to use boost.filesystem
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <cctype>
|
||||
#include <fstream>
|
||||
@ -381,6 +382,8 @@ bool tex2lyx(string const &infilename, string const &outfilename)
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
fs::path::default_name_check(fs::no_check);
|
||||
|
||||
easyParse(argc, argv);
|
||||
|
||||
if (argc <= 1) {
|
||||
@ -390,7 +393,8 @@ int main(int argc, char * argv[])
|
||||
}
|
||||
|
||||
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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user