diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 0c04be43ff..93d4620a4e 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,11 @@ +2003-08-01 Jean-Marc Lasgouttes + + * path_defines.C.in (setLyxPaths): re-introduce the code to check + whether lyx is run in place + (build_dir): renamed from build_lyxdir + (build_lyxdir): give this better semantics compatible with what + LibFileSearch expects. + 2003-07-29 Angus Leeming * filename.[Ch] (relFilename, outputFilename): the 'path' arg diff --git a/src/support/path_defines.C.in b/src/support/path_defines.C.in index 58301f685c..e32103e3ae 100644 --- a/src/support/path_defines.C.in +++ b/src/support/path_defines.C.in @@ -32,6 +32,9 @@ namespace { // Store for the path to the lyx support files we're actually going to use. string system_lyxdir_; +// Store for the path to the autogenerated files when running in place +string build_lyxdir_; + // Store for the path to the user-level support files. string user_lyxdir_; @@ -72,13 +75,25 @@ string const & lyx_localedir() } -string const & build_lyxdir() +string const & build_dir() { static string const bl = "%BUILDDIR%"; return bl; } +string const & build_lyxdir() +{ + return build_lyxdir_; +} + + +void build_lyxdir(string const & sld) +{ + build_lyxdir_ = sld; +} + + string const & system_lyxdir() { return system_lyxdir_; @@ -122,6 +137,26 @@ bool setLyxPaths() lyxerr[Debug::INIT] << "Name of binary: " << binname << endl; lyxerr[Debug::INIT] << "Path of binary: " << binpath << endl; + + string searchpath; + + // + // Determine whether we are running in place and set + // build_lyxdir accordingly + // + + string const buildlyxdir = MakeAbsPath("../lib", binpath); + if (!FileSearch(buildlyxdir, "lyxrc.defaults").empty()) { + searchpath += AddPath(lyx_top_srcdir(), "lib") + ';'; + build_lyxdir(buildlyxdir); + lyxerr[Debug::INIT] << "Checking whether LyX is run in " + "place... yes" << endl; + } else { + lyxerr[Debug::INIT] + << "Checking whether LyX is run in place... no" + << endl; + } + // // Determine system directory. // @@ -141,7 +176,6 @@ bool setLyxPaths() // and the hardcoded lyx_dir is used. // If we had a command line switch, system_lyxdir_ is already set - string searchpath; if (!system_lyxdir_.empty()) searchpath = MakeAbsPath(system_lyxdir_) + ';'; diff --git a/src/support/path_defines.h b/src/support/path_defines.h index 4846c2af35..c16645cd40 100644 --- a/src/support/path_defines.h +++ b/src/support/path_defines.h @@ -19,17 +19,15 @@ namespace support { string const & lyx_localedir(); -/* The absolute path to the lyx build directory. - * (Make-time value.) - */ -string const & build_lyxdir(); - /// The absolute path to the lyx support files we're actually going to use. string const & system_lyxdir(); /// Set the absolute path to the lyx support files (from the command line). void system_lyxdir(string const &); +/// The absolute path to the lyx support files in the build directory +string const & build_lyxdir(); + /// The absolute path to the user-level lyx support files. string const & user_lyxdir();