Branch: Tag:

2019-01-16

2019-01-16 10:38:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Master: Use the Posix/NT implementation of dirname()...

The "Rip out final remains of OS2 and AmigaOS" commit
kept the AmigaOS implementation of dirname() (and got
rid of the NT/Posix variant). It survived a year...

566:   string dirname(string x)   {    if(x=="") return ""; -  array(string) tmp=x/":"; -  array(string) tmp2=tmp[-1]/"/"; -  tmp[-1]=tmp2[..<1]*"/"; -  if(sizeof(tmp2) >= 2 && tmp2[-2]=="") tmp[-1]+="/"; -  return tmp*":"; +  array(string) tmp = EXPLODE_PATH(x); +  if (x[0] == '/' && sizeof(tmp) < 3) return "/"; +  return tmp[..<1]*"/";   }      //! Returns the last segment of a path.