display.setCurrent(wc);
try {
Enumeration e;
FileConnection currDir = null;
List browser = createBrowser();
if (MEGA_ROOT.equals(currDirName)) {
e = FileSystemRegistry.listRoots();
} else {
currDir = (FileConnection) Connector.open("file://localhost/"
+ currDirName);
e = currDir.list();
// not root - draw UP_DIRECTORY
browser.append(UP_DIRECTORY, dirIcon);
}
while (e.hasMoreElements()) {
String fileName = (String) e.nextElement();
if (fileName.charAt(fileName.length() - 1) == FilePath.separatorChar)
browser.append(fileName, dirIcon);
else if (fileName.toLowerCase().endsWith(".sgf"))
browser.append(fileName, sgfFileIcon);
else if (fileName.toLowerCase().endsWith(".sgfi"))
browser.append(fileName, sgfiFileIcon);
else
browser.append(fileName, fileIcon);
}
if (currDir != null)
currDir.close();