changeset 18413:f8f37595c29f

maint: Periodic merge of gui-release -> stable.
author Rik <rik@octave.org>
date Thu, 30 Jan 2014 16:11:29 -0800
parents 1e148ecdeedd (current diff) f74c6aaa6d0f (diff)
children 68fc31c69fcb
files
diffstat 3 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__fltk_uigetfile__.cc	Wed Jan 29 15:28:35 2014 -0500
+++ b/libinterp/dldfcn/__fltk_uigetfile__.cc	Thu Jan 30 16:11:29 2014 -0800
@@ -123,10 +123,10 @@
         }
 
       if (multi_type == Fl_File_Chooser::DIRECTORY)
-        retval(0) = std::string (fc.value ());
+        retval(0) = file_ops::native_separator_path (std::string (fc.value ()));
       else
         {
-          retval(1) = std::string (fc.directory ()) + sep;
+          retval(1) = file_ops::native_separator_path (std::string (fc.directory ()) + sep);
           retval(2) = fc.filter_value () + 1;
         }
     }
--- a/liboctave/system/file-ops.cc	Wed Jan 29 15:28:35 2014 -0500
+++ b/liboctave/system/file-ops.cc	Thu Jan 30 16:11:29 2014 -0800
@@ -362,6 +362,27 @@
             : dir + dir_sep_char () + file);
 }
 
+std::string
+file_ops::native_separator_path (const std::string& path)
+{
+  std::string retval;
+
+  if (dir_sep_char () == '/')
+    retval = path;
+  else
+    {
+      size_t n = path.length ();
+      for (size_t i = 0; i < n; i++)
+        {
+          if (path[i] == '/')
+            retval += dir_sep_char();
+          else
+            retval += path[i];
+        }
+    }
+
+  return retval;
+}
 
 int
 octave_mkdir (const std::string& nm, mode_t md)
--- a/liboctave/system/file-ops.h	Wed Jan 29 15:28:35 2014 -0500
+++ b/liboctave/system/file-ops.h	Thu Jan 30 16:11:29 2014 -0800
@@ -95,6 +95,9 @@
     return path.substr (ipos);
   }
 
+  // convert path from UNIX type separators to whatever is the system separators
+  static std::string native_separator_path (const std::string& path);
+
 private:
 
   static file_ops *instance;