有没有办法让 JSON 对象检查文件路径,如果它不存在,则使用默认路径?
最终我需要它来做到这一点:(逻辑表示)
{
"filePath": "path/to/custom" ? "path/to/custom" : "path/to/default"
}
您可以将不同的路径添加到数组中。喜欢:
{
"filePath": [..., ...]
}
或者如果您只需要两条路径:
{
"filePath": {custom: ..., default: ...}
}.
您必须找到一种方法来检查路径是否存在。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句