Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,16 @@ class TextDocumentServiceHandlerTest {
return uri
}

if (uri.startsWith("file://C:/")) {
val path = uri.substringAfter("file://C:/")
return "file:///C:/$path"
if (uri.startsWith("file://$windowsDrive:/")) {
val path = uri.substringAfter("file://$windowsDrive:/")
return "file:///$windowsDrive:/$path"
}

val path = uri.substringAfter("file:///")
return "file:///C:/$path"
return "file:///$windowsDrive:/$path"
}

private val windowsDrive: String
get() = java.nio.file.Paths.get("").toAbsolutePath().root
?.toString()?.firstOrNull()?.uppercaseChar()?.toString() ?: "C"
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class FileUriUtilTest {
every { isDirectory } returns mockIsDirectory
}

private val windowsDrive: String
get() = java.nio.file.Paths.get("").toAbsolutePath().root
?.toString()?.firstOrNull()?.uppercaseChar()?.toString() ?: "C"

private fun normalizeFileUri(uri: String): String {
if (!System.getProperty("os.name").lowercase().contains("windows")) {
return uri
Expand All @@ -34,7 +38,7 @@ class FileUriUtilTest {
}

val path = uri.substringAfter("file:///")
return "file:///C:/$path"
return "file:///$windowsDrive:/$path"
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ class WorkspaceFolderUtilTest {
}

// for windows unit tests
private val windowsDrive: String
get() = java.nio.file.Paths.get("").toAbsolutePath().root
?.toString()?.firstOrNull()?.uppercaseChar()?.toString() ?: "C"

private fun normalizeFileUri(uri: String): String {
if (!System.getProperty("os.name").lowercase().contains("windows")) {
return uri
Expand All @@ -105,6 +109,6 @@ class WorkspaceFolderUtilTest {
return uri
}
val path = uri.substringAfter("file:///")
return "file:///C:/$path"
return "file:///$windowsDrive:/$path"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,10 @@ class WorkspaceServiceHandlerTest {
}

// for windows unit tests
private val windowsDrive: String
get() = java.nio.file.Paths.get("").toAbsolutePath().root
?.toString()?.firstOrNull()?.uppercaseChar()?.toString() ?: "C"

private fun normalizeFileUri(uri: String): String {
if (!System.getProperty("os.name").lowercase().contains("windows")) {
return uri
Expand All @@ -829,6 +833,6 @@ class WorkspaceServiceHandlerTest {
}

val path = uri.substringAfter("file:///")
return "file:///C:/$path"
return "file:///$windowsDrive:/$path"
}
}