]> git.lyx.org Git - features.git/commitdiff
Cmate tests: Use absolute values for systemlyxdir
authorKornel Benko <kornel@lyx.org>
Sat, 30 Mar 2019 11:01:16 +0000 (12:01 +0100)
committerKornel Benko <kornel@lyx.org>
Sat, 30 Mar 2019 11:06:36 +0000 (12:06 +0100)
This omits use of relative path for the \origin variable
inside the test-build-dir.

development/autotests/lyxStatus.pm

index 6c3001953fe89903541b9831bcd85bce270dc35b..0c6677691c1c9cd98ce85d1f2184c01dbb292a04 100644 (file)
@@ -37,6 +37,7 @@ my @stack = ();                       # list of HASH-Arrays
 my $rFont = {};
 my $useNonTexFont = "true";
 my $inputEncoding = undef;
+my $sysdir = undef;
 
 # The elements are:
 # type (layout, inset, header, preamble, ...)
@@ -52,6 +53,8 @@ my $inputEncoding = undef;
 
 sub initLyxStack($$$)
 {
+  use Cwd 'abs_path';
+
   $rFont = $_[0];
   if ($_[1] eq "systemF") {
     $useNonTexFont = "true";
@@ -64,6 +67,11 @@ sub initLyxStack($$$)
     $inputEncoding = $_[2];
   }
   $stack[0] = { type => "Starting"};
+  my $p = abs_path( __FILE__ );
+  $p =~ s/\/development\/autotests\/.*$/\/lib/;
+  # Save the value to be used as replacement for systemlyxdir in \origin statements
+  $sysdir = $p;
+  # print "Sysdir set to $sysdir\n";
 }
 
 sub diestack($)
@@ -235,6 +243,10 @@ sub checkForHeader($)
                              "result" => ["\\inputencoding " . $inputEncoding->{out}]);
       push(@rElems, $inputenc);
     }
+    my $origin = newMatch("search" => qr/^\\origin\s+(\/systemlyxdir)(.*)$/,
+                          "filetype" => "replace_only",
+                          "result" => ["\\origin $sysdir", "2"]);
+    push(@rElems, $origin);
     setMatching(\@rElems);
     return(1);
   }