diff options
| author | JosJuice <josjuice@gmail.com> | 2017-02-08 14:00:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-08 14:00:12 +0100 |
| commit | 99492c22a6a6e7d7d565c4731b9870b6dadbf26e (patch) | |
| tree | 583989737b86b107d0507517c3465a916dde9365 /Source/Core/Common/LibusbContext.cpp | |
| parent | 027719d8e2b09c6795d235e7d56803fb09885522 (diff) | |
| parent | b6d526ba2e94e1bcb155c7d6b2eee7833e3ae81b (diff) | |
Merge pull request #4839 from leoetlino/better-warnings
Be less annoying when usbdk is not installed
Diffstat (limited to 'Source/Core/Common/LibusbContext.cpp')
| -rw-r--r-- | Source/Core/Common/LibusbContext.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/Core/Common/LibusbContext.cpp b/Source/Core/Common/LibusbContext.cpp index a2ed128200..1eb729c4a0 100644 --- a/Source/Core/Common/LibusbContext.cpp +++ b/Source/Core/Common/LibusbContext.cpp @@ -8,6 +8,7 @@ #include "Common/LibusbContext.h" #include "Common/MsgHandler.h" +#include "Common/StringUtil.h" namespace LibusbContext { @@ -24,10 +25,12 @@ static libusb_context* Create() #ifdef _WIN32 is_windows = true; #endif - if (is_windows && ret == LIBUSB_ERROR_NOT_FOUND) - PanicAlertT("Failed to initialize libusb because usbdk is not installed."); - else - PanicAlertT("Failed to initialize libusb: %s", libusb_error_name(ret)); + const std::string reason = + is_windows && ret == LIBUSB_ERROR_NOT_FOUND ? + GetStringT("Failed to initialize libusb because usbdk is not installed.") : + StringFromFormat(GetStringT("Failed to initialize libusb (%s).").c_str(), + libusb_error_name(ret)); + PanicAlertT("%s\nSome USB features will not work.", reason.c_str()); return nullptr; } return context; |
