Notify adb missing

There are many user who encounters missing adb.
To stop things happens again, we check it and show
sexy response to user.

Signed-off-by: yuchenlin <npes87184@gmail.com>
This commit is contained in:
yuchenlin
2018-09-01 09:18:06 +08:00
committed by Romain Vimont
parent 3b5e54278e
commit 6d2d803003
4 changed files with 88 additions and 14 deletions

View File

@@ -4,7 +4,7 @@
#include "log.h"
#include "str_util.h"
HANDLE cmd_execute(const char *path, const char *const argv[]) {
int cmd_execute(const char *path, const char *const argv[], HANDLE *handle) {
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
@@ -18,7 +18,8 @@ HANDLE cmd_execute(const char *path, const char *const argv[]) {
size_t ret = xstrjoin(cmd, argv, ' ', sizeof(cmd));
if (ret >= sizeof(cmd)) {
LOGE("Command too long (%" PRIsizet " chars)", sizeof(cmd) - 1);
return NULL;
*handle = NULL;
return -1;
}
#ifdef WINDOWS_NOCONSOLE
@@ -27,10 +28,12 @@ HANDLE cmd_execute(const char *path, const char *const argv[]) {
int flags = 0;
#endif
if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, flags, NULL, NULL, &si, &pi)) {
return NULL;
*handle = NULL;
return -1;
}
return pi.hProcess;
*handle = pi.hProcess;
return 0;
}
SDL_bool cmd_terminate(HANDLE handle) {