Skip to content

Commit

Permalink
fix: fix Windows start with blank issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Mar 3, 2022
1 parent b955394 commit a06b126
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ abstract class BaseAnalyser(private var config: ChapiConfig) : IAnalyser {

fun readFileAsString(filepath: String): String {
val bufferedReader: BufferedReader = File(filepath).bufferedReader()
return bufferedReader.use { it.readText() }
var text = bufferedReader.use { it.readText() }

// fix for Window issue
if (text.startsWith("\uFEFF")) {
text = text.substring(1);
}
return text
}

abstract fun analysisByFiles(files: Array<AbstractFile>): Array<CodeDataStruct>
Expand Down

0 comments on commit a06b126

Please # to comment.