This repository has been archived on 2025-08-26. You can view files and clone it, but cannot push or open issues or pull requests.
Files
enginex_bi_series-sherpa-onnx/sherpa-onnx/csrc/file-utils.cc
2023-02-24 21:39:51 +08:00

25 lines
498 B
C++

// sherpa-onnx/csrc/file-utils.cc
//
// Copyright (c) 2022-2023 Xiaomi Corporation
#include "sherpa-onnx/csrc/file-utils.h"
#include <fstream>
#include <string>
#include "sherpa-onnx/csrc/log.h"
namespace sherpa_onnx {
bool FileExists(const std::string &filename) {
return std::ifstream(filename).good();
}
void AssertFileExists(const std::string &filename) {
if (!FileExists(filename)) {
SHERPA_ONNX_LOG(FATAL) << filename << " does not exist!";
}
}
} // namespace sherpa_onnx