From 1f8efa6e6453cff4c8f951c65565d3ed5f25d2c9 Mon Sep 17 00:00:00 2001 From: hedgecrw85 Date: Wed, 14 Apr 2021 09:16:26 -0500 Subject: [PATCH] Switch order of name mangling for port path detection --- src/main/java/com/fazecast/jSerialComm/SerialPort.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/fazecast/jSerialComm/SerialPort.java b/src/main/java/com/fazecast/jSerialComm/SerialPort.java index cbcda53..5830d00 100644 --- a/src/main/java/com/fazecast/jSerialComm/SerialPort.java +++ b/src/main/java/com/fazecast/jSerialComm/SerialPort.java @@ -328,10 +328,9 @@ public final class SerialPort else if (!((new File(portDescriptor)).exists())) { // Attempt to locate the correct port descriptor - if (portDescriptor.contains("/")) + portDescriptor = "/dev/" + portDescriptor; + if (!((new File(portDescriptor)).exists())) portDescriptor = "/dev/" + portDescriptor.substring(portDescriptor.lastIndexOf('/')+1); - else - portDescriptor = "/dev/" + portDescriptor; // Check if the updated port descriptor exists if (!((new File(portDescriptor)).exists()))