From 73d90ed5c449bb916e9987d895db2ba23b97a2dd Mon Sep 17 00:00:00 2001
From: idk <hankhill19580@gmail.com>
Date: Thu, 3 Feb 2022 01:51:33 -0500
Subject: [PATCH] Don't add os-arch to pluginname if it's already correct

---
 .../src/net/i2p/router/web/ShellService.java  | 25 ++++++++++---------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ShellService.java b/apps/routerconsole/java/src/net/i2p/router/web/ShellService.java
index 084d1263c1..3fdcdb7e1d 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/ShellService.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/ShellService.java
@@ -104,24 +104,25 @@ public class ShellService implements ClientApp {
 
         String tmp_name = this.getName();
         File pluginDir = new File(_context.getConfigDir(), PLUGIN_DIR + '/' + tmp_name);
-        if (!pluginDir.exists())
+        if (!pluginDir.exists()){
             pluginDir = new File(_context.getConfigDir(), PLUGIN_DIR + '/' + tmp_name+"-"+SystemVersion.getOS()+"-"+SystemVersion.getArch());
-
-        if (!pluginDir.exists()) {
-            pluginDir = new File(_context.getConfigDir(), PLUGIN_DIR + '/' + tmp_name+"-"+SystemVersion.getOS());
-            if (!pluginDir.exists())
-                throw new RuntimeException("Plugin directory does not exist: " + pluginDir.getAbsolutePath());
-            else{
-                this.name = tmp_name+"-"+SystemVersion.getOS();
+            if (!pluginDir.exists()) {
+                pluginDir = new File(_context.getConfigDir(), PLUGIN_DIR + '/' + tmp_name+"-"+SystemVersion.getOS());
+                if (!pluginDir.exists()) {
+                    throw new RuntimeException("Plugin directory does not exist: " + pluginDir.getAbsolutePath());
+                } else {
+                    this.name = tmp_name+"-"+SystemVersion.getOS();
+                    if (_log.shouldDebug())
+                        _log.debug("ShellService: Plugin name revised to match directory: " + this.getName());
+                }
+            } else {
+                this.name = tmp_name+"-"+SystemVersion.getOS()+"-"+SystemVersion.getArch();
                 if (_log.shouldDebug())
                     _log.debug("ShellService: Plugin name revised to match directory: " + this.getName());
             }
-        } else {
-            this.name = tmp_name+"-"+SystemVersion.getOS()+"-"+SystemVersion.getArch();
-            if (_log.shouldDebug())
-                _log.debug("ShellService: Plugin name revised to match directory: " + this.getName());
         }
 
+
         _errorLog = new File(pluginDir, "error.log");
         _outputLog = new File(pluginDir, "output.log");
         _pb.redirectOutput(_outputLog);
-- 
GitLab