Skip to content

Commit eddf91f

Browse files
authored
Handle empty package names (#20)
1 parent cfc549b commit eddf91f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • grease/src/main/kotlin/io/deepmedia/tools/grease

grease/src/main/kotlin/io/deepmedia/tools/grease/files.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ val File.packageNames: Set<String>
4343
if (file.name != "module-info.class") {
4444
val cleanedPath = file.path.removePrefix(this.path).removePrefix("/")
4545
cleanedPath
46-
.substring(0 until cleanedPath.lastIndexOf('/'))
47-
.replace('/', '.')
46+
.substring(0 until cleanedPath.lastIndexOf('/').coerceAtLeast(0))
47+
.replace('/', '.').takeIf { it.isNotBlank() }
4848
} else null
4949
}.toSet()

0 commit comments

Comments
 (0)