diff liboctave/file-ops.h @ 9182:23af5910e5f5

make load work for derived classses
author Robert T. Short <octave@phaselockedsystems.com>
date Tue, 05 May 2009 14:11:43 -0400
parents eb63fbe60fab
children 62eb444704ba
line wrap: on
line diff
--- a/liboctave/file-ops.h	Tue May 05 13:32:15 2009 -0400
+++ b/liboctave/file-ops.h	Tue May 05 14:11:43 2009 -0400
@@ -109,6 +109,19 @@
     return static_members::dir_sep_chars ();
   }
 
+  // Return the tail member of a path.
+  static std::string tail (std::string path)
+  {
+    size_t ipos = path.find_last_of (dir_sep_chars ());
+
+    if (ipos != std::string::npos)
+      ipos++;
+    else
+      ipos = 0;
+
+    return path.substr (ipos);
+  }
+
 private:
 
   // Use a singleton class for these data members instead of just