Skip to content

Commit

Permalink
feat: 使用平台 API 替换 FileLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
suiyun39 committed Jan 15, 2024
1 parent ac30c1a commit 24830b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/sh/suiyun/chooseLicense/utils/Resource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ object Resource {
* 解析 LICENSE 文件模板, 获取 spdx-id 和正文内容
*/
fun parseLicenseTemplate(fileName: String): Pair<String, String> {
val file = FileLoader.get().load("/licenses/$fileName", this.javaClass)
val text = file.readText()
val file = this.javaClass.getResource("/licenses/$fileName")
val text = file?.readText() ?: ""

// 拆分 meta 和正文
val matchResult = "(?s)---(.*?)---(.*)".toRegex().find(text)
Expand Down

0 comments on commit 24830b2

Please sign in to comment.