void (int id, @Nullable Path pathToSelect, boolean updatePathBar, boolean updateHistory) { var cancelled = new AtomicBoolean(false); update(id, cancelled, () -> { myCurrentDirectory = null; updatePathBarAndHistory(null, updatePathBar, updateHistory); }); var roots = new ArrayList<Path>(); for (var root : FileSystems.getDefault().getRootDirectories()) roots.add(root); if (WSLUtil.isSystemCompatible() && Experiments.getInstance().isFeatureEnabled("wsl.p9.show.roots.in.file.chooser")) { try { List<WSLDistribution> distributions = WslDistributionManager.getInstance().getInstalledDistributionsFuture().get(200, TimeUnit.MILLISECONDS); for (var distribution : distributions) roots.add(distribution.getUNCRootPath()); } catch (Exception e) { LOG.warn(e); } } var selection = new AtomicReference<FsItem>(); var error = new AtomicReference<String>(); for (var root : roots) { if (cancelled.get()) break; try { var attrs = Files.readAttributes(root, BasicFileAttributes.class); var virtualFile = new LazyDirectoryOrFile(null, root, attrs); var name = NioFiles.getFileName(root); if (name.length() > 1 && name.endsWith(File.separator)) { name = name.substring(0, name.length() - 1); } if (SystemInfo.isWindows) { try { var store = Files.getFileStore(root).name(); if (!store.isBlank()) { name += " [" + store + ']'; } } catch (IOException e) { LOG.debug(e); } } var item = new FsItem(root, name, null, true, myDescriptor.isFileSelectable(virtualFile), AllIcons.Nodes.Folder); update(id, cancelled, () -> myModel.addRow(item)); if (pathToSelect != null && root.equals(pathToSelect)) { selection.set(item); } } catch (Exception e) { LOG.warn(root.toString(), e); error.set(e.getMessage()); } } if (!cancelled.get()) { update(id, cancelled, () -> { myList.setPaintBusy(false); updateSelection(selection); reportError("file.chooser.cannot.load.roots", error); }); } }