>>>>> "Joost" == Joost Verburg <[EMAIL PROTECTED]> writes:
>> Is it that you have lyxrc.defaults, but not textclass.lst in your >> user directory. In this case, the following should help. Joost> No, see the debug output I mailed earlier today. This one misses the <package>...</package> part. Could you add it? Joost> I have no configuration files (except lyxrc.dist) at all in Joost> both the LyX Resources directory and the users directory. And the users directory exists? Joost> I expect it to run configure, but it won't do so unless I put Joost> some old textclass.lst in the LyX Resources directory. Could you try this version with more debug statements? JMarc
Index: src/ChangeLog =================================================================== --- src/ChangeLog (revision 13791) +++ src/ChangeLog (working copy) @@ -1,3 +1,12 @@ +2006-05-03 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * lyx_main.C (init): call queryUserLyXDir before reading lyxrc + files. + (needsUpdate): new helper function; returns true if file does not + exist or is older than configure.py. + (queryUserLyXDir): check textclass.lst and packages.lst in + addition to lyxrc.defaults. + 2006-04-28 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> * lyx_main.C (readRcFile): do not report an error if file is not Index: src/lyx_main.C =================================================================== --- src/lyx_main.C (revision 13791) +++ src/lyx_main.C (working copy) @@ -401,12 +401,18 @@ void LyX::init(bool gui) signal(SIGTERM, error_handler); // SIGPIPE can be safely ignored. +#if !defined (USE_POSIX_PACKAGING) + // Add the directory containing the LyX executable to the path + // so that LyX can find things like tex2lyx. + if (package().build_support().empty()) + prependEnvPath("PATH", package().binary_dir()); +#endif + // Check that user LyX directory is ok. We don't do that if // running in batch mode. - bool reconfigure = false; if (gui) { - reconfigure = - queryUserLyXDir(package().explicit_user_support()); + if (queryUserLyXDir(package().explicit_user_support())) + reconfigureUserLyXDir(); } else { first_start = false; } @@ -475,18 +481,6 @@ void LyX::init(bool gui) if (!lyxrc.path_prefix.empty()) prependEnvPath("PATH", lyxrc.path_prefix); -#if !defined (USE_POSIX_PACKAGING) - // Add the directory containing the LyX executable to the path - // so that LyX can find things like tex2lyx. - if (package().build_support().empty()) - prependEnvPath("PATH", package().binary_dir()); -#endif - - // Having reset the PATH we're now in a position to run configure - // if necessary. - if (reconfigure) - reconfigureUserLyXDir(); - if (fs::exists(lyxrc.document_path) && fs::is_directory(lyxrc.document_path)) package().document_dir() = lyxrc.document_path; @@ -609,25 +603,43 @@ void LyX::deadKeyBindings(kb_keymap * kb } -bool LyX::queryUserLyXDir(bool explicit_userdir) +namespace { + +// return true if file does not exist or is older than configure.py. +bool needsUpdate(string const & file) { - bool reconfigure = false; + static string const configure_script = + AddName(package().system_support(), "configure.py"); + string const absfile = + AddName(package().user_support(), file); + + lyxerr << "absfile=" << absfile << ", exists=" << fs::exists(absfile); + if (fs::exists(absfile)) + lyxerr << ", write(conf)=" << fs::last_write_time(configure_script) + << ", write(file)=" << fs::last_write_time(absfile) + << ", result=" << ((! fs::exists(absfile)) + || (fs::last_write_time(configure_script) + > fs::last_write_time(absfile))); + lyxerr << endl; + + return (! fs::exists(absfile)) + || (fs::last_write_time(configure_script) + > fs::last_write_time(absfile)); +} +} + + +bool LyX::queryUserLyXDir(bool explicit_userdir) +{ // Does user directory exist? if (fs::exists(package().user_support()) && fs::is_directory(package().user_support())) { first_start = false; - string const configure_script = - AddName(package().system_support(), "configure.py"); - string const userDefaults = - AddName(package().user_support(), "lyxrc.defaults"); - if (fs::exists(configure_script) && - fs::exists(userDefaults) && - fs::last_write_time(configure_script) - > fs::last_write_time(userDefaults)) { - reconfigure = true; - } - return reconfigure; + + return needsUpdate("lyxrc.defaults") + || needsUpdate("textclass.lst") + || needsUpdate("packages.lst"); } first_start = !explicit_userdir; @@ -651,7 +663,6 @@ bool LyX::queryUserLyXDir(bool explicit_ lyxerr << bformat(_("LyX: Creating directory %1$s"), package().user_support()) << endl; - reconfigure = true; if (!createDirectory(package().user_support(), 0755)) { // Failed, so let's exit. @@ -660,7 +671,7 @@ bool LyX::queryUserLyXDir(bool explicit_ exit(1); } - return reconfigure; + return true; }