|
|
|
@ -160,15 +160,24 @@ GLFWbool _glfwInitJoysticksLinux(void) |
|
|
|
|
|
|
|
|
|
while ((entry = readdir(dir))) |
|
|
|
|
{ |
|
|
|
|
char path[20]; |
|
|
|
|
regmatch_t match; |
|
|
|
|
char* path = NULL; |
|
|
|
|
|
|
|
|
|
if (regexec(&_glfw.linjs.regex, entry->d_name, 1, &match, 0) != 0) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name); |
|
|
|
|
if (asprintf(&path, "%s/%s", dirname, entry->d_name) < 0) |
|
|
|
|
{ |
|
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR, |
|
|
|
|
"Linux: Failed to construct device path: %s", |
|
|
|
|
strerror(errno)); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (openJoystickDevice(path)) |
|
|
|
|
count++; |
|
|
|
|
|
|
|
|
|
free(path); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closedir(dir); |
|
|
|
|