Team Ai
Apppublic

Xenobd/whisper.cpp

sourceHugging Faceupdated 10mo agoView on Hugging Face
0likes
deprecation-warning.cpp39 linesDownload Raw Back to deprecation-warning
1// Warns users that this filename was deprecated, and provides a link for more information.2 3#include <cstdio>4#include <string>5 6// Main7int main(int argc, char** argv) {8    std::string filename = "main";9    if (argc >= 1) {10        filename = argv[0];11    }12 13    // Get only the program name from the full path14    size_t pos = filename.find_last_of("/\\");15    if (pos != std::string::npos) {16        filename = filename.substr(pos+1);17    }18 19    // Append "whisper-" to the beginning of filename to get the replacemnt filename20    std::string replacement_filename = "whisper-" + filename;21 22    // The exception is if the filename is "main", then our replacement filename is "whisper-cli"23    if (filename == "main") {24        replacement_filename = "whisper-cli";25    }26 27    if (filename == "main.exe") {28        replacement_filename = "whisper-cli.exe";29    }30 31    fprintf(stdout, "\n");32    fprintf(stdout, "WARNING: The binary '%s' is deprecated.\n", filename.c_str());33    fprintf(stdout, " Please use '%s' instead.\n", replacement_filename.c_str());34    fprintf(stdout, " See https://github.com/ggerganov/whisper.cpp/tree/master/examples/deprecation-warning/README.md for more information.\n");35    fprintf(stdout, "\n");36 37    return EXIT_FAILURE;38}39