ha, better name, also doesn't start with conflicting letter.
[feisty_meow.git] / nucleus / library / filesystem / filename.cpp
index 1ab0c0d496dabf4c1503e3414b9fc5ebb871bda6..adca7e99dcee76d0d31b12f473c455897d594d95 100644 (file)
@@ -304,6 +304,18 @@ bool filename::is_executable() const
   return !!(fill.st_mode & S_IEXEC);
 }
 
+bool filename::is_normal() const
+{
+  status_info fill;
+  if (!get_info(&fill))
+    return false;
+  bool weird = S_ISCHR(fill.st_mode)
+      || S_ISBLK(fill.st_mode)
+      || S_ISFIFO(fill.st_mode)
+      || S_ISSOCK(fill.st_mode);
+  return !weird;
+}
+
 int filename::find_last_separator(const astring &look_at) const
 {
   int last_sep = -1;
@@ -422,7 +434,7 @@ void filename::separate(string_array &pieces) const
     if (separator(raw_form[i])) {
       // this is a separator character, so eat it and add the accumulated
       // string to the list.
-      if (!i || accumulator.length()) pieces += accumulator;
+      if (i && accumulator.length()) pieces += accumulator;
       // now reset our accumulated text.
       accumulator = astring::empty_string();
     } else {