feat: Add argument to check library
This mode allows checking if the DLL can be found, without having to create any kind of dummy data or parse stderr.
This commit is contained in:
parent
7c74a3e786
commit
a615ae0354
1 changed files with 10 additions and 1 deletions
|
@ -30,6 +30,7 @@ void usage() {
|
|||
"\n"
|
||||
"Options:\n"
|
||||
" -v Increase Oodle's verbosity. May be specified up to three times.\n"
|
||||
" -c Only check if the library can be found and used.\n"
|
||||
"\n"
|
||||
"The following environmental variables are recognized:\n"
|
||||
" DLL_SEARCH_PATH: A color (':') separated list of directories to search for the Oodle library. May be relative to the current working directory.\n";
|
||||
|
@ -38,6 +39,7 @@ void usage() {
|
|||
int main(int argc, char* argv[])
|
||||
{
|
||||
int verbosity = 0;
|
||||
bool check_lib = FALSE;
|
||||
int i = 1;
|
||||
|
||||
for (; i < argc; i++) {
|
||||
|
@ -51,6 +53,9 @@ int main(int argc, char* argv[])
|
|||
usage();
|
||||
return 0;
|
||||
}
|
||||
else if (strcmp(arg, "-c") == 0) {
|
||||
check_lib = TRUE;
|
||||
}
|
||||
else if (strcmp(arg, "-v") == 0) {
|
||||
verbosity++;
|
||||
}
|
||||
|
@ -96,12 +101,16 @@ int main(int argc, char* argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto decompress = (decltype(OodleLZ_Decompress)*)GetProcAddress((HMODULE)hDLL, "OodleLZ_Decompress");
|
||||
auto decompress = reinterpret_cast<decompress_func>(GetProcAddress((HMODULE)hDLL, "OodleLZ_Decompress"));
|
||||
if (decompress == NULL) {
|
||||
std::cerr << "ERROR: The library is incompatible!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (check_lib) {
|
||||
std::cout << "INFO: '" << LIB_FILE << "' found and loaded.\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc - i < 3) {
|
||||
std::cerr << "ERROR: Arguments missing!\n\n";
|
||||
|
|
Reference in a new issue