mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
util: split bom checking to a separate fn (#6694)
This commit is contained in:
parent
be02ee97fb
commit
7b5a580c0c
@ -223,9 +223,14 @@ pub fn path_of_executable(path string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_file(file_path string) ?string {
|
pub fn read_file(file_path string) ?string {
|
||||||
mut raw_text := os.read_file(file_path) or {
|
raw_text := os.read_file(file_path) or {
|
||||||
return error('failed to open $file_path')
|
return error('failed to open $file_path')
|
||||||
}
|
}
|
||||||
|
return skip_bom(raw_text)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn skip_bom(file_content string) string {
|
||||||
|
mut raw_text := file_content
|
||||||
// BOM check
|
// BOM check
|
||||||
if raw_text.len >= 3 {
|
if raw_text.len >= 3 {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
Loading…
Reference in New Issue
Block a user