30 lines
537 B
Go
30 lines
537 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package f5
|
|
|
|
import (
|
|
"q5"
|
|
"strings"
|
|
)
|
|
|
|
func ReadJsonFile(fileName string) (string, error) {
|
|
if tmpStr, err := q5.ReadTextFile(fileName); err != nil {
|
|
return tmpStr, err
|
|
} else {
|
|
switch q5.JsonStrType(tmpStr) {
|
|
case q5.JSON_ARRAY, q5.JSON_OBJECT:
|
|
{
|
|
return tmpStr, nil
|
|
}
|
|
default:
|
|
index := strings.LastIndex(fileName, "/")
|
|
if index <= 0 {
|
|
return q5.ReadTextFile(fileName + "/" + tmpStr)
|
|
} else {
|
|
return q5.ReadTextFile(fileName[0:index+1] + tmpStr)
|
|
}
|
|
}
|
|
}
|
|
}
|