def basename=(new_basename)
      base = basename
      if base.to_s.empty?
        self.path += new_basename
      else
        rpath = normalized_path.reverse
        # replace the last occurrence of the basename with basename.ext
        self.path = rpath.sub(%r|#{Regexp.escape(base.reverse)}|, new_basename.reverse).reverse
      end
      basename
    end
def basename=(new_basename)
      base = basename
      if base.to_s.empty?
        self.path += new_basename
      else
        rpath = normalized_path.reverse
        # replace the last occurrence of the basename with basename.ext
        self.path = rpath.sub(%r|#{Regexp.escape(base.reverse)}|, new_basename.reverse).reverse
      end
      basename
    end
Set the basename, replacing it if it exists.

 @param [String] New basename
 @return [String] basename result