]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/includable-lexer.cc
Merge branch 'master' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond into lilypond...
[lilypond.git] / lily / includable-lexer.cc
index 09b97da0178a3c5a7e15e16a8bf30ee73c0f8798..7d506373f32788674bf3c3fd8bc4f02720cdf33e 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the LilyPond music typesetter
 
-  (c) 1997--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "includable-lexer.hh"
@@ -37,6 +37,8 @@ using namespace std;
   (yy_buffer_stack != 0 ? yy_buffer_stack[yy_buffer_stack_top] : 0)
 #endif
 
+extern bool relative_includes;
+
 Includable_lexer::Includable_lexer ()
 {
 #if HAVE_FLEXLEXER_YY_CURRENT_BUFFER
@@ -48,8 +50,9 @@ Includable_lexer::Includable_lexer ()
 void
 Includable_lexer::new_input (string name, Sources *sources)
 {
-  string current_dir = include_stack_.size () ?
-    dir_name (include_stack_.back ()->name_string ()) : "";
+  string current_dir = dir_name (main_input_name_);
+  if (relative_includes)
+    current_dir = include_stack_.size () ? dir_name (include_stack_.back ()->name_string ()) : "";
 
   Source_file *file = sources->get_file (name, current_dir);
   if (!file)