void (@NotNull String target, @NotNull Consumer<? super @NotNull File> createdSubstTester) { assertTrue(SystemInfo.isWindows); File targetFile = new File(target); assertTrue(targetFile.getPath(), targetFile.isDirectory()); String substRoot = getFirstFreeDriveLetter() + ":"; runCommand("subst", substRoot, targetFile.getPath()); File rootFile = new File(substRoot + "\\"); assertTrue("target=" + targetFile + ", subst=" + rootFile, rootFile.isDirectory()); try { createdSubstTester.accept(rootFile); } finally { runCommand("subst", StringUtil.trimEnd(substRoot, '\\'), "/d"); } }