changeset 15225:2d337a9869e9

correctly handle multiple --path command line arguments * octave.cc (command_line_path): Now a list of strings. (octave_process_command_line): Append --path args to command_line_path list. (octave_initialize_interpreter): Call load_path::set_command_line_path on each element of commnad_line_path list.
author John W. Eaton <jwe@octave.org>
date Thu, 23 Aug 2012 19:07:34 -0400
parents a44e4a08fc55
children a0af93de0ba3
files libinterp/octave.cc
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave.cc	Thu Aug 23 17:53:42 2012 -0400
+++ b/libinterp/octave.cc	Thu Aug 23 19:07:34 2012 -0400
@@ -138,7 +138,7 @@
 
 // The value of "path" specified on the command line.
 // (--path; -p)
-static std::string command_line_path;
+static std::list<std::string> command_line_path;
 
 // Flags used to determine what commands should be echoed when they are
 // parsed and executed.
@@ -758,7 +758,7 @@
 
         case 'p':
           if (optarg)
-            command_line_path = optarg;
+            command_line_path.push_back (optarg);
           break;
 
         case 'q':
@@ -931,8 +931,9 @@
   if (! read_history_file)
     bind_internal_variable ("saving_history", false);
 
-  if (! command_line_path.empty ())
-    load_path::set_command_line_path (command_line_path);
+  for (std::list<std::string>::const_iterator it = command_line_path.begin ();
+       it != command_line_path.end (); it++)
+    load_path::set_command_line_path (*it);
 
   if (echo_executing_commands)
     bind_internal_variable ("echo_executing_commands",