mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-04-13 03:16:12 +00:00
Only show error when no single input could be readed
This commit is contained in:
@@ -87,8 +87,8 @@ public class Limelight implements NvConnectionListener {
|
|||||||
displayError("Input", "Input could not be found");
|
displayError("Input", "Input could not be found");
|
||||||
return;
|
return;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
displayError("Input", "Input could not be read");
|
displayError("Input", "No input could be readed");
|
||||||
displayError("Input", "Are you running as root?");
|
displayError("Input", "Try to run as root");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,21 +43,38 @@ public class EvdevLoader implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void start() throws FileNotFoundException, IOException {
|
public void start() throws FileNotFoundException, IOException {
|
||||||
boolean watcher = false;
|
boolean allInputs = inputs.isEmpty();
|
||||||
|
|
||||||
if (inputs.isEmpty()) {
|
if (allInputs) {
|
||||||
watcher = true;
|
|
||||||
|
|
||||||
String[] events = input.list(filter);
|
String[] events = input.list(filter);
|
||||||
|
|
||||||
for (String event:events)
|
for (String event:events)
|
||||||
inputs.add(new File(input, event).getAbsolutePath());
|
inputs.add(new File(input, event).getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String input:inputs)
|
boolean hasInput = false;
|
||||||
new EvdevHandler(conn, input, mapping).start();
|
IOException ex = null;
|
||||||
|
for (String input:inputs) {
|
||||||
|
try {
|
||||||
|
EvdevHandler handler = new EvdevHandler(conn, input, mapping);
|
||||||
|
handler.start();
|
||||||
|
hasInput = true;
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (IOException e) {
|
||||||
|
//Throw always exception for explicitly loaded inputs
|
||||||
|
if (!allInputs)
|
||||||
|
throw e;
|
||||||
|
else
|
||||||
|
ex = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (watcher) {
|
//Only throw exception when no input get loaded
|
||||||
|
if (!hasInput && ex != null)
|
||||||
|
throw ex;
|
||||||
|
|
||||||
|
if (allInputs) {
|
||||||
Thread thread = new Thread(this);
|
Thread thread = new Thread(this);
|
||||||
thread.setDaemon(true);
|
thread.setDaemon(true);
|
||||||
thread.setName("Input - Search");
|
thread.setName("Input - Search");
|
||||||
|
|||||||
Reference in New Issue
Block a user