Skip to content

Commit

Permalink
Removing logging
Browse files Browse the repository at this point in the history
  • Loading branch information
arafatkatze committed Dec 30, 2024
1 parent 71e5432 commit 52b4cee
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,31 +196,27 @@ object CodyEditorUtil {
}

fun findFileOrScratch(project: Project, uriString: String): VirtualFile? {

try {
val normalizedUri = if (uriString.matches(Regex("^[A-Za-z]:.+"))) {
"file:///" + uriString.replace('\\', '/')
} else {
uriString
}

val uri = URI.create(normalizedUri)


if (ConfigUtil.isIntegrationTestModeEnabled()) {
return TempFileSystem.getInstance().refreshAndFindFileByPath(uri.path)
} else {
val fixedUri = if (uriString.startsWith("untitled")) {
uri.withScheme("file")
} else uri
val path = fixedUri.toPath()
return LocalFileSystem.getInstance().refreshAndFindFileByNioFile(path)
uri.withScheme("file")
} else uri
val path = fixedUri.toPath()
return LocalFileSystem.getInstance().refreshAndFindFileByNioFile(path)
}
} catch (e: URISyntaxException) {
// Let's try scratch files
val fileName = uriString.substringAfterLast(':').trimStart('/', '\\')
return ScratchRootType.getInstance()
.findFile(project, fileName, ScratchFileService.Option.existing_only)
.findFile(project, fileName, ScratchFileService.Option.existing_only)
}
}

Expand Down

0 comments on commit 52b4cee

Please sign in to comment.