|
|
@ -161,18 +161,14 @@ GLFWbool _glfwInitJoysticksLinux(void) |
|
|
|
while ((entry = readdir(dir))) |
|
|
|
while ((entry = readdir(dir))) |
|
|
|
{ |
|
|
|
{ |
|
|
|
regmatch_t match; |
|
|
|
regmatch_t match; |
|
|
|
char* path = NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (regexec(&_glfw.linjs.regex, entry->d_name, 1, &match, 0) != 0) |
|
|
|
if (regexec(&_glfw.linjs.regex, entry->d_name, 1, &match, 0) != 0) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
if (asprintf(&path, "%s/%s", dirname, entry->d_name) < 0) |
|
|
|
const size_t length = strlen(dirname) + strlen(entry->d_name) + 1; |
|
|
|
{ |
|
|
|
char* path = calloc(length + 1, 1); |
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR, |
|
|
|
|
|
|
|
"Linux: Failed to construct device path: %s", |
|
|
|
snprintf(path, length + 1, "%s/%s", dirname, entry->d_name); |
|
|
|
strerror(errno)); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (openJoystickDevice(path)) |
|
|
|
if (openJoystickDevice(path)) |
|
|
|
count++; |
|
|
|
count++; |
|
|
|