dirname(filename) {
    var lastSlash = filename.lastIndexOf('/');
    if (lastSlash === -1)
      return '.';
    if (lastSlash === 0)
      return '/';
    return filename.slice(0, lastSlash);
  }
@return {string} The directory part of a file name.
Emulates node path.dirname.