# HG changeset patch # User jwe # Date 1151691582 0 # Node ID 44f24cf66b959ff961307e0485e56b4dbf5a5e4c # Parent b9fd54407c8d7d96049c505f2a3e9ad28f7a4bee [project @ 2006-06-30 18:19:20 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,7 +1,10 @@ 2006-06-30 John W. Eaton - * dir-ops.cc (dir_entry::open): Perform tilde expansion here. + * lo-sysdep.cc (octave_chdir): Perform tilde expansion here. + * cmd-edit.cc (editor::read_init_file): Ditto. + * dir-ops.cc (dir_entry::open): Ditto. * file-stat.cc (stat::update_internal): Ditto. + * cmd-hist.cc (command_history::set_file): Ditto. * data-conv.cc (data_conv::string_to_data_type): Correctly handle leading "*". diff --git a/liboctave/cmd-edit.cc b/liboctave/cmd-edit.cc --- a/liboctave/cmd-edit.cc +++ b/liboctave/cmd-edit.cc @@ -41,6 +41,7 @@ #include "cmd-edit.h" #include "cmd-hist.h" +#include "file-ops.h" #include "lo-error.h" #include "lo-utils.h" #include "oct-env.h" @@ -833,10 +834,14 @@ } void -command_editor::read_init_file (const std::string& file) +command_editor::read_init_file (const std::string& file_arg) { if (instance_ok ()) - instance->do_read_init_file (file); + { + std::string file = file_ops::tilde_expand (file_arg); + + instance->do_read_init_file (file); + } } bool diff --git a/liboctave/cmd-hist.cc b/liboctave/cmd-hist.cc --- a/liboctave/cmd-hist.cc +++ b/liboctave/cmd-hist.cc @@ -32,6 +32,7 @@ #include "cmd-edit.h" #include "cmd-hist.h" +#include "file-ops.h" #include "lo-error.h" #include "str-vec.h" @@ -413,10 +414,14 @@ } void -command_history::set_file (const std::string& f) +command_history::set_file (const std::string& f_arg) { if (instance_ok ()) - instance->do_set_file (f); + { + std::string f = file_ops::tilde_expand (f_arg); + + instance->do_set_file (f); + } } std::string diff --git a/liboctave/lo-sysdep.cc b/liboctave/lo-sysdep.cc --- a/liboctave/lo-sysdep.cc +++ b/liboctave/lo-sysdep.cc @@ -35,6 +35,7 @@ #include #endif +#include "file-ops.h" #include "lo-error.h" #include "pathlen.h" @@ -64,8 +65,10 @@ } int -octave_chdir (const std::string& path) +octave_chdir (const std::string& path_arg) { + std::string path = file_ops::tilde_expand (path_arg); + #if defined (__EMX__) int retval = -1; diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2006-06-30 John W. Eaton + * oct-hist.cc (do_history, initialize_history, Fhistory_file): + Don't perform tilde expansion on history file name. + + * syscalls.cc (Flstat, Fstat): Don't perform tilde expansion on arg. + * input.cc (Fread_readline_init_file): Likewise. + * dirfns.cc (Fcd, Freaddir): Likewise. + * load-path.cc (genpath): Don't perform tilde expansion on name. (load_path::do_add): Don't warn about moving "." to front of list. diff --git a/src/dirfns.cc b/src/dirfns.cc --- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -121,7 +121,7 @@ if (argc > 1) { - std::string dirname = file_ops::tilde_expand (argv[1]); + std::string dirname = argv[1]; if (dirname.length () > 0 && ! octave_change_to_directory (dirname)) @@ -266,7 +266,7 @@ gripe_wrong_type_arg ("readdir", args(0)); else { - dir_entry dir (file_ops::tilde_expand (dirname)); + dir_entry dir (dirname); if (dir) { diff --git a/src/input.cc b/src/input.cc --- a/src/input.cc +++ b/src/input.cc @@ -1042,7 +1042,7 @@ command_editor::read_init_file (); else if (nargin == 1) { - std::string file = file_ops::tilde_expand (args(0).string_value ()); + std::string file = args(0).string_value (); if (! error_state) command_editor::read_init_file (file); diff --git a/src/oct-hist.cc b/src/oct-hist.cc --- a/src/oct-hist.cc +++ b/src/oct-hist.cc @@ -173,10 +173,7 @@ || option == "-n") { if (i < argc - 1) - { - std::string file = file_ops::tilde_expand (argv[i+1]); - command_history::set_file (file); - } + command_history::set_file (argv[i+1]); if (option == "-a") // Append `new' lines to file. @@ -551,7 +548,7 @@ void initialize_history (void) { - command_history::set_file (file_ops::tilde_expand (Vhistory_file)); + command_history::set_file (Vhistory_file); command_history::set_size (Vhistory_size); command_history::read (false); @@ -719,7 +716,7 @@ octave_value retval = SET_INTERNAL_VARIABLE (history_file); if (Vhistory_file != saved_history_file) - command_history::set_file (file_ops::tilde_expand (Vhistory_file)); + command_history::set_file (Vhistory_file); return retval; } diff --git a/src/syscalls.cc b/src/syscalls.cc --- a/src/syscalls.cc +++ b/src/syscalls.cc @@ -561,7 +561,7 @@ if (args.length () == 1) { - std::string fname = file_ops::tilde_expand (args(0).string_value ()); + std::string fname = args(0).string_value (); if (! error_state) { @@ -798,7 +798,7 @@ if (args.length () == 1) { - std::string fname = file_ops::tilde_expand (args(0).string_value ()); + std::string fname = args(0).string_value (); if (! error_state) {