changeset 5872:44f24cf66b95

[project @ 2006-06-30 18:19:20 by jwe]
author jwe
date Fri, 30 Jun 2006 18:19:42 +0000
parents b9fd54407c8d
children b6ef36e92701
files liboctave/ChangeLog liboctave/cmd-edit.cc liboctave/cmd-hist.cc liboctave/lo-sysdep.cc src/ChangeLog src/dirfns.cc src/input.cc src/oct-hist.cc src/syscalls.cc
diffstat 9 files changed, 37 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,7 +1,10 @@
 2006-06-30  John W. Eaton  <jwe@octave.org>
 
-	* 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 "*".
--- 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
--- 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
--- a/liboctave/lo-sysdep.cc
+++ b/liboctave/lo-sysdep.cc
@@ -35,6 +35,7 @@
 #include <unistd.h>
 #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;
 
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
 2006-06-30  John W. Eaton  <jwe@octave.org>
 
+	* 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.
 
--- 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)
 	    {
--- 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);
--- 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;
 }
--- 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)
 	{