Skip to content

Commit 6276993

Browse files
authored
Fix python sys.path rendering (#2674)
Improve python sys path rendering
1 parent be99664 commit 6276993

File tree

1 file changed

+5
-1
lines changed
  • utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/utils

1 file changed

+5
-1
lines changed

utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/utils/StringUtils.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ import java.nio.file.FileSystems
44

55

66
fun String.toRelativeRawPath(): String {
7-
return "os.path.dirname(__file__) + r'${FileSystems.getDefault().separator}${this}'"
7+
val dirname = "os.path.dirname(__file__)"
8+
if (this.isEmpty()) {
9+
return dirname
10+
}
11+
return "$dirname + r'${FileSystems.getDefault().separator}${this}'"
812
}

0 commit comments

Comments
 (0)