Ok, Jean-Marc. Here is a refinement of Ruurd's patch to determine the name 
of the LyX system directory from the name of the LyX binary. Are you happy 
with this or should we discuss it some more?

-- 
Angus
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1021.2.53
diff -u -p -r1.1021.2.53 ChangeLog
--- src/ChangeLog	15 Dec 2004 19:35:06 -0000	1.1021.2.53
+++ src/ChangeLog	16 Dec 2004 17:25:25 -0000
@@ -1,4 +1,11 @@
- 2004-12-14  Angus Leeming  <[EMAIL PROTECTED]>
+2004-12-16  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* lyx_main.C (init): on a Windows build, remove the ".exe"
+	extension from the name of the LyX binary when trying to
+	ascertain the name of the LyX system directory.
+	(Usually, <path to binary>/../share/<name of binary>/).
+
+2004-12-14  Angus Leeming  <[EMAIL PROTECTED]>
  
 	* LaTeX.C: (operator()): use os::nulldev() rather than "/dev/null".
 
Index: src/lyx_main.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_main.C,v
retrieving revision 1.134.2.5
diff -u -p -r1.134.2.5 lyx_main.C
--- src/lyx_main.C	15 Dec 2004 19:35:10 -0000	1.134.2.5
+++ src/lyx_main.C	16 Dec 2004 17:25:25 -0000
@@ -288,8 +288,19 @@ void LyX::init(bool gui)
 	bool followlink;
 	do {
 		// Path of binary/../share/name of binary/
-		searchpath += NormalizePath(AddPath(binpath, "../share/") +
-		      OnlyFilename(binname)) + ';';
+
+		string const exe_name = OnlyFilename(binname);
+		string const lyx_system_dir_name =
+#ifdef _WIN32
+			suffixIs(exe_name, ".exe") ?
+				ChangeExtension(exe_name, "") :
+				exe_name;
+#else
+			exe_name;
+#endif
+		string const shared_dir_name =
+			NormalizePath(AddPath(binpath, "../share/"));
+		searchpath += shared_dir_name + lyx_system_dir_name + ';';
 
 		// Follow Symlinks
 		FileInfo file(fullbinpath, true);
Index: src/support/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.287
diff -u -p -r1.287 ChangeLog
--- src/support/ChangeLog	16 Dec 2004 01:03:34 -0000	1.287
+++ src/support/ChangeLog	16 Dec 2004 17:25:40 -0000
@@ -1,5 +1,10 @@
 2004-12-16  Angus Leeming  <[EMAIL PROTECTED]>
 
+	* path_defines.C.in (setLyxPaths): on a Windows build, remove the
+	".exe" extension from the name of the LyX binary when trying to
+	ascertain the name of the LyX system directory.
+	(Usually, <path to binary>/../share/<name of binary>/).
+
 	* mkdir.C: move the HAVE_MKDIR conditional code out of config.h
 	and into here.
 
Index: src/support/path_defines.C.in
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/path_defines.C.in,v
retrieving revision 1.14
diff -u -p -r1.14 path_defines.C.in
--- src/support/path_defines.C.in	15 Dec 2004 19:35:43 -0000	1.14
+++ src/support/path_defines.C.in	16 Dec 2004 17:25:40 -0000
@@ -217,8 +217,19 @@ bool setLyxPaths()
 	bool followlink;
 	do {
 		// Path of binary/../share/name of binary/
-		searchpath += NormalizePath(AddPath(binpath, "../share/") +
-		      OnlyFilename(binname)) + ';';
+
+		string const exe_name = OnlyFilename(binname);
+		string const lyx_system_dir_name =
+#ifdef _WIN32
+			suffixIs(exe_name, ".exe") ?
+				ChangeExtension(exe_name, "") :
+				exe_name;
+#else
+			exe_name;
+#endif
+		string const shared_dir_name =
+			NormalizePath(AddPath(binpath, "../share/"));
+		searchpath += shared_dir_name + lyx_system_dir_name + ';';
 
 		// Follow Symlinks
 		FileInfo file(fullbinpath, true);

Reply via email to