Am Donnerstag, 3. Januar 2013 um 13:11:48, schrieb Kornel Benko <kor...@lyx.org>
> Hi,
> if we compile with program suffix, the at least on cmake build
> tex2lyx2.1 is not able to find lyx2.1. Instead, it is searching for
> "lyx2.1.1"
> 

The problem here is Package.cpp:348
abs_binary == "tex2lyx2.1" is a path which already ends with 
'string(PROGRAM_SUFFIX)'
and the extracted extension is "1"
The following search for lyx-executable uses this extension appending it
to the search name in lyxBinaryPath()

Of course, no such executable exists.

Something like the attached works.

        Kornel
diff --git a/src/support/Package.cpp b/src/support/Package.cpp
index a158b49..cb2f7ff 100644
--- a/src/support/Package.cpp
+++ b/src/support/Package.cpp
@@ -348,7 +348,14 @@ bool lyxBinaryPath(FileName & lyx_binary, string const & search_dir, string cons
 FileName findLyxBinary(FileName const & abs_binary)
 {
     string ext;
-    if (!abs_binary.extension().empty()) {
+    string checkname = abs_binary.toFilesystemEncoding();
+    int check_len = checkname.length();
+    int prgsuffixlen = string(PROGRAM_SUFFIX).length();
+    if ((check_len > prgsuffixlen) &&
+       (checkname.substr(check_len-prgsuffixlen) == string(PROGRAM_SUFFIX))) {
+	ext = "";
+    }
+    else if (!abs_binary.extension().empty()) {
         ext = "." + abs_binary.extension();
     }
     

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to