From 91a2738dc907d2755a56686a1c7a2aeebe876036 Mon Sep 17 00:00:00 2001 From: janneke Date: Wed, 8 Jun 2005 13:45:29 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 6 ++++++ flower/file-path.cc | 4 ++-- lily/lily-parser-scheme.cc | 20 +++++++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f53ac857e4..1cebd1ba76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,12 @@ 2005-06-08 Jan Nieuwenhuizen + * flower/file-path.cc (find): Bugfix. Append rather than prepend + directory part of file name to search directory. + + * lily/lily-parser-scheme.cc (ly:parse-file): Prepend cwd to + search path and chdir to DIR if --outname=DIR used. + * lily/main.cc (prepend_env_path): Bugfix: Check directory existence before appending original path. diff --git a/flower/file-path.cc b/flower/file-path.cc index 1df873325f..ddadfaca5b 100644 --- a/flower/file-path.cc +++ b/flower/file-path.cc @@ -130,8 +130,8 @@ File_path::find (String name) const if (file_name.dir_.is_empty ()) file_name.dir_ = dir.to_string (); else if (!dir.to_string ().is_empty()) - file_name.dir_ += ::to_string (DIRSEP) + dir.to_string (); - + file_name.dir_ = dir.to_string () + + ::to_string (DIRSEP) + file_name.dir_; if (is_file (file_name.to_string ())) return file_name.to_string (); } diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index ab80fff1ec..0563d403c0 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -54,7 +54,25 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", out_file_name.dir_ = ""; if (!output_name_global.is_empty ()) - out_file_name = File_name (output_name_global); + { + if (is_dir (output_name_global)) + { + char cwd[PATH_MAX]; + getcwd (cwd, PATH_MAX); + + if (output_name_global != cwd) + { + global_path.prepend (cwd); + message (_f ("Changing working directory to `%s'", + output_name_global.to_str0 ())); + chdir (output_name_global.to_str0 ()); + + } + output_name_global = ""; + } + else + out_file_name = File_name (output_name_global); + } String init; if (!init_name_global.is_empty ()) -- 2.39.5