From 2ee664dd4198a1a2ad3b308d295e78794f040a97 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tamarin Date: Fri, 3 Nov 2023 14:00:09 +0300 Subject: [PATCH] Improve python sys path rendering --- .../org/utbot/python/framework/codegen/utils/StringUtils.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/utils/StringUtils.kt b/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/utils/StringUtils.kt index 409b7acc85..40f3b5b831 100644 --- a/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/utils/StringUtils.kt +++ b/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/utils/StringUtils.kt @@ -4,5 +4,9 @@ import java.nio.file.FileSystems fun String.toRelativeRawPath(): String { - return "os.path.dirname(__file__) + r'${FileSystems.getDefault().separator}${this}'" + val dirname = "os.path.dirname(__file__)" + if (this.isEmpty()) { + return dirname + } + return "$dirname + r'${FileSystems.getDefault().separator}${this}'" } \ No newline at end of file