Skip to content

Commit

Permalink
Handle empty package names (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xera authored Oct 31, 2024
1 parent cfc549b commit eddf91f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions grease/src/main/kotlin/io/deepmedia/tools/grease/files.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ val File.packageNames: Set<String>
if (file.name != "module-info.class") {
val cleanedPath = file.path.removePrefix(this.path).removePrefix("/")
cleanedPath
.substring(0 until cleanedPath.lastIndexOf('/'))
.replace('/', '.')
.substring(0 until cleanedPath.lastIndexOf('/').coerceAtLeast(0))
.replace('/', '.').takeIf { it.isNotBlank() }
} else null
}.toSet()

0 comments on commit eddf91f

Please sign in to comment.