code: private static String escapeFileSeparatorChar(String fname)
    {
      if (File.separatorChar == '\\')
      {
        return fname.replaceAll(File.separator + File.separator, "_");
      }
      else
      {
        return fname.replaceAll(File.separator, "_");
      }
    }
docs: Escape file separator char to underscore. This prevents the file name
  from using file path separator.
  
  @param fname
  @return escaped file name