Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix: file size check for zero rather than just exists" #10

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions gopiper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,16 @@ using namespace std;
int _piper_tts(char *text, char *model, char *espeakData, char *tashkeelPath, char *dst, optional<piper::SpeakerId> speakerId) {
filesystem::path model_path;
filesystem::path config_path;
error_code ec;
uintmax_t fsize;

model_path = filesystem::path(std::string(model));
config_path = filesystem::path(std::string(model) + ".json");

fsize = filesystem::file_size(model_path, &ec);
if (ec) {
spdlog::debug("Error while checking Model Path ({}) :: ({})", model_path.c_str(), ec.message());
return EXIT_FAILURE;
} else if (fsize == 0) {
spdlog::debug("Error while checking Model Path ({}) :: zero size", model_path.c_str());
if (!filesystem::exists(model_path)) {
spdlog::debug("Error: Model path does not exist: ({})", model_path.c_str());
return EXIT_FAILURE;
}

fsize = filesystem::file_size(config_path, &ec);
if (ec) {
spdlog::debug("Error while checking Model Path ({}) :: ({})", config_path.c_str(), ec.message());
return EXIT_FAILURE;
} else if (fsize == 0) {
spdlog::debug("Error while checking Model Path ({}) :: zero size", config_path.c_str());
if (!filesystem::exists(config_path)) {
spdlog::debug("Error: Config path does not exist: ({})", config_path.c_str());
return EXIT_FAILURE;
}

Expand Down