diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2017-02-06 22:19:47 +0100 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2017-02-07 00:47:21 +0100 |
| commit | db7ee668ff205de373d9463fc485bc560acf8e7b (patch) | |
| tree | 2cc3d7b931e88fd44189e58e26fb7121be25b8b0 | |
| parent | f5a3aac8e1ef77c3f1c1e30f47e15222752a538b (diff) | |
Notify user that USB won't work if libusb init fails
| -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; |
