mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Add way to disable "no extensions found" message (#2134)
We want it enabled by default, but there have been requests for a way to disable it.
This commit is contained in:
committed by
Peter Johnson
parent
4f951789fe
commit
b2ae75acd8
@@ -41,6 +41,11 @@ void InitializeExtensions() {}
|
||||
} // namespace init
|
||||
} // namespace hal
|
||||
|
||||
static bool& GetShowNotFoundMessage() {
|
||||
static bool showMsg = true;
|
||||
return showMsg;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
int HAL_LoadOneExtension(const char* library) {
|
||||
@@ -91,8 +96,10 @@ int HAL_LoadExtensions(void) {
|
||||
wpi::SmallVector<wpi::StringRef, 2> libraries;
|
||||
const char* e = std::getenv("HALSIM_EXTENSIONS");
|
||||
if (!e) {
|
||||
wpi::outs() << "HAL Extensions: No extensions found\n";
|
||||
wpi::outs().flush();
|
||||
if (GetShowNotFoundMessage()) {
|
||||
wpi::outs() << "HAL Extensions: No extensions found\n";
|
||||
wpi::outs().flush();
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
wpi::StringRef env{e};
|
||||
@@ -105,4 +112,8 @@ int HAL_LoadExtensions(void) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
void HAL_SetShowExtensionsNotFoundMessages(HAL_Bool showMessage) {
|
||||
GetShowNotFoundMessage() = showMessage;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user