fix use java nio Path

This commit is contained in:
Vladimir Krivosheev
2016-04-07 16:50:35 +02:00
parent 4417d22c43
commit 63e4eae92d
4 changed files with 9 additions and 10 deletions
@@ -60,10 +60,9 @@ private class DefaultWebServerRootsProvider : WebServerRootsProvider() {
runReadAction { ModuleManager.getInstance(project).modules }
.computeOrNull { module ->
if (!module.isDisposed) {
val result = findByRelativePath(path, rootProvider.getRoots(ModuleRootManager.getInstance(module)), resolver, null)
if (result != null) {
result.moduleName = getModuleNameQualifier(project, module)
return result
findByRelativePath(path, rootProvider.getRoots(ModuleRootManager.getInstance(module)), resolver, null)?.let {
it.moduleName = getModuleNameQualifier(project, module)
return it
}
}
null
@@ -11,9 +11,9 @@ import com.intellij.util.writeChild
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
private class BuiltInWebServerTest : BuiltInServerTestCase() {
internal class BuiltInWebServerTest : BuiltInServerTestCase() {
override val urlPathPrefix: String
get() = "/${BuiltInServerTestCase.projectRule.project.name}"
get() = "/${projectRule.project.name}"
@Test
@TestManager.TestDescriptor(filePath = "foo/index.html", doNotCreate = true, status = 200)
@@ -34,7 +34,7 @@ private class BuiltInWebServerTest : BuiltInServerTestCase() {
}
private fun testIndex(vararg paths: String) {
val project = BuiltInServerTestCase.projectRule.project
val project = projectRule.project
val newPath = tempDirManager.newPath()
newPath.writeChild(manager.filePath!!, "hello")
newPath.refreshVfs()
@@ -8,7 +8,7 @@ import org.junit.Test
import java.net.HttpURLConnection
import java.net.URL
private class RestApiTest : BuiltInServerTestCase() {
internal class RestApiTest : BuiltInServerTestCase() {
override val urlPathPrefix = "/api/file"
@Test
@@ -141,7 +141,7 @@ fun Path.refreshVfs() {
inline fun <R> Path.directoryStreamIfExists(task: (stream: DirectoryStream<Path>) -> R): R? {
try {
Files.newDirectoryStream(this).use(task)
return Files.newDirectoryStream(this).use(task)
}
catch (ignored: NoSuchFileException) {
}
@@ -150,7 +150,7 @@ inline fun <R> Path.directoryStreamIfExists(task: (stream: DirectoryStream<Path>
inline fun <R> Path.directoryStreamIfExists(noinline filter: ((path: Path) -> Boolean), task: (stream: DirectoryStream<Path>) -> R): R? {
try {
Files.newDirectoryStream(this, { filter.invoke(it) }).use(task)
return Files.newDirectoryStream(this, { filter.invoke(it) }).use(task)
}
catch (ignored: NoSuchFileException) {
}