mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 02:20:42 +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");
|
||||
return;
|
||||
} catch (IOException ex) {
|
||||
displayError("Input", "Input could not be read");
|
||||
displayError("Input", "Are you running as root?");
|
||||
displayError("Input", "No input could be readed");
|
||||
displayError("Input", "Try to run as root");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,21 +43,38 @@ public class EvdevLoader implements Runnable {
|
||||
}
|
||||
|
||||
public void start() throws FileNotFoundException, IOException {
|
||||
boolean watcher = false;
|
||||
boolean allInputs = inputs.isEmpty();
|
||||
|
||||
if (inputs.isEmpty()) {
|
||||
watcher = true;
|
||||
|
||||
if (allInputs) {
|
||||
String[] events = input.list(filter);
|
||||
|
||||
for (String event:events)
|
||||
inputs.add(new File(input, event).getAbsolutePath());
|
||||
}
|
||||
|
||||
for (String input:inputs)
|
||||
new EvdevHandler(conn, input, mapping).start();
|
||||
boolean hasInput = false;
|
||||
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.setDaemon(true);
|
||||
thread.setName("Input - Search");
|
||||
|
||||
Reference in New Issue
Block a user