Mercurial > hg > octave-terminal
changeset 4804:6202d9b75f83
[project @ 2004-02-27 16:40:59 by jwe]
author | jwe |
---|---|
date | Fri, 27 Feb 2004 16:40:59 +0000 |
parents | 62a606d49393 |
children | b0d6da24caeb |
files | src/ChangeLog src/octave.cc |
diffstat | 2 files changed, 27 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-02-27 John W. Eaton <jwe@bevo.che.wisc.edu> + + * octave.cc (execute_startup_files): Don't find current directory + for absolute name of local_rc until after executing home_rc. + 2004-02-24 John W. Eaton <jwe@bevo.che.wisc.edu> * input.cc (input_event_hook): Return type is now int. Return 0.
--- a/src/octave.cc +++ b/src/octave.cc @@ -235,7 +235,7 @@ // $OCTAVE_INITFILE. If $OCTAVE_INITFILE is not set, .octaverc // is assumed. - int home_rc_already_executed = 0; + bool home_rc_already_executed = false; std::string initfile = octave_env::getenv ("OCTAVE_INITFILE"); @@ -244,9 +244,9 @@ std::string home_dir = octave_env::get_home_directory (); - std::string home_rc = home_dir + file_ops::dir_sep_str + initfile; - std::string local_rc - = octave_env::getcwd () + file_ops::dir_sep_str + initfile; + std::string home_rc = octave_env::make_absolute (initfile, home_dir); + + std::string local_rc; if (! home_dir.empty ()) { @@ -258,15 +258,31 @@ if (fs_home_rc) { + // We want to check for curr_dir after executing home_rc + // because doing that may change the working directory. + + std::string curr_dir = octave_env::getcwd (); + + local_rc = octave_env::make_absolute (initfile, curr_dir); + file_stat fs_dot_rc (local_rc); if (fs_dot_rc && fs_home_rc.ino () == fs_dot_rc.ino ()) - home_rc_already_executed = 1; + home_rc_already_executed = true; } } if (! home_rc_already_executed) - parse_and_execute (local_rc, verbose); + { + if (local_rc.empty ()) + { + std::string curr_dir = octave_env::getcwd (); + + local_rc = octave_env::make_absolute (initfile, curr_dir); + } + + parse_and_execute (local_rc, verbose); + } } unwind_protect::run_frame ("execute_startup_files");