From 7ee07344704c23868a70d83676a0a26346b8f8de Mon Sep 17 00:00:00 2001 From: Nolan Poe Date: Thu, 27 Nov 2014 16:10:14 -0800 Subject: [PATCH] Fix joystick pathname construction --- src/SFML/Window/Unix/JoystickImpl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SFML/Window/Unix/JoystickImpl.cpp b/src/SFML/Window/Unix/JoystickImpl.cpp index 867d076a..0b8d4793 100644 --- a/src/SFML/Window/Unix/JoystickImpl.cpp +++ b/src/SFML/Window/Unix/JoystickImpl.cpp @@ -49,8 +49,8 @@ namespace for (unsigned int i = 0; i < sf::Joystick::Count; ++i) { - std::ostringstream name("js"); - name << i; + std::ostringstream name; + name << "js" << i; std::string nameString = name.str(); int file = ::open(("/dev/input/" + nameString).c_str(), O_RDONLY); @@ -260,8 +260,8 @@ bool JoystickImpl::open(unsigned int index) { if (plugged[index]) { - std::ostringstream name("/dev/input/js"); - name << index; + std::ostringstream name; + name << "/dev/input/js" << index; // Open the joystick's file descriptor (read-only and non-blocking) m_file = ::open(name.str().c_str(), O_RDONLY | O_NONBLOCK);