- File cache = new File(dir, preselector);
- cache.mkdirs();
- File cacheHtml = new File(cache, "index.html");
- cache = new File(cache, ".cache");
+ StringBuilder gopherBuilder = new StringBuilder();
+ StringBuilder htmlBuilder = new StringBuilder();
+
+ BasicSupport.setPreselector(preselector);
+ for (Type type : Type.values()) {
+ BasicSupport support = BasicSupport.getSupport(type);
+
+ if (type == this.type || this.type == null) {
+ list(support);
+ }
+
+ gopherBuilder.append(getLink(support.getDescription(),
+ support.getSelector(), true, false));
+
+ String ref = support.getSelector();
+ while (ref.startsWith("/")) {
+ ref = ref.substring(1);
+ }
+ ref = "../" + ref + "/index.html";
+
+ htmlBuilder.append(getLink(support.getDescription(), ref, false,
+ true));
+ }
+
+ File gopherCache = new File(dir, preselector);
+ gopherCache.mkdirs();
+ File htmlIndex = new File(gopherCache, "index.html");
+ gopherCache = new File(gopherCache, ".cache");