>>>>> "Joost" == Joost Verburg <[EMAIL PROTECTED]> writes:

Joost> The idea is to have no lyxrc.defaults, textclass.lst and
Joost> packages.lst in the LyX directory but only in the users
Joost> directory?

Joost> It doesn't seem to work on Windows. When I start LyX for the
Joost> first time, I would expect it to run configure.py to create
Joost> those files in the users directory. However, it gives an error
Joost> "unable to find textclass file" instead.

Could you try one of the following patches? They make sure that
reconfiguration is done if lyxrc.defaults is not found.

JMarc

Index: src/lyx_main.C
===================================================================
--- src/lyx_main.C	(revision 13790)
+++ src/lyx_main.C	(working copy)
@@ -611,8 +611,6 @@ void LyX::deadKeyBindings(kb_keymap * kb
 
 bool LyX::queryUserLyXDir(bool explicit_userdir)
 {
-	bool reconfigure = false;
-
 	// Does user directory exist?
 	if (fs::exists(package().user_support()) &&
 	    fs::is_directory(package().user_support())) {
@@ -621,13 +619,14 @@ bool LyX::queryUserLyXDir(bool explicit_
 			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;
+
+		// reconfigure is required if either (1) userDefaults
+		// does not exist or (2) it exists but configure.py is
+		// newer.
+		return fs::exists(configure_script) 
+			&& (! fs::exists(userDefaults) 
+			    || fs::last_write_time(configure_script)
+			    > fs::last_write_time(userDefaults));
 	}
 
 	first_start = !explicit_userdir;
@@ -651,7 +650,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 +658,7 @@ bool LyX::queryUserLyXDir(bool explicit_
 		exit(1);
 	}
 
-	return reconfigure;
+	return true;
 }
 
 
Index: src/lyx_main.C
===================================================================
--- src/lyx_main.C	(revision 13789)
+++ src/lyx_main.C	(working copy)
@@ -611,8 +611,6 @@ void LyX::deadKeyBindings(kb_keymap * kb
 
 bool LyX::queryUserLyXDir(bool explicit_userdir)
 {
-	bool reconfigure = false;
-
 	// Does user directory exist?
 	if (fs::exists(package().user_support()) &&
 	    fs::is_directory(package().user_support())) {
@@ -621,13 +619,14 @@ bool LyX::queryUserLyXDir(bool explicit_
 			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;
+
+		// reconfigure is required if either (1) userDefaults
+		// does not exist or (2) it exists but configure.py is
+		// newer.
+		return fs::exists(configure_script) 
+			&& (! fs::exists(userDefaults) 
+			    || fs::last_write_time(configure_script)
+			    > fs::last_write_time(userDefaults));
 	}
 
 	first_start = !explicit_userdir;
@@ -651,7 +650,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 +658,7 @@ bool LyX::queryUserLyXDir(bool explicit_
 		exit(1);
 	}
 
-	return reconfigure;
+	return true;
 }
 
 

Reply via email to