Browse Source

Trim the PuTTY path before trying to use it. Hooray for C# goto!

Douglas Thrift 11 years ago
parent
commit
13d612bb54
1 changed files with 7 additions and 3 deletions
  1. 7 3
      ssh-handler/ssh-handler.cs

+ 7 - 3
ssh-handler/ssh-handler.cs

@@ -112,7 +112,7 @@ public class SshHandler
     private static bool FindPutty()
     {
         if (puttyPath != null)
-            return true;
+            goto found;
 
         foreach (RegistryHive hive in new RegistryHive[] { RegistryHive.CurrentUser, RegistryHive.LocalMachine })
         {
@@ -131,7 +131,7 @@ public class SshHandler
                         if (File.Exists(puttyPath))
                         {
                             Debug.WriteLine("Found PuTTY in registry: {0}", puttyPath, null);
-                            return true;
+                            goto found;
                         }
                         else
                             puttyPath = null;
@@ -144,13 +144,17 @@ public class SshHandler
             if (File.Exists(puttyPath))
             {
                 Debug.WriteLine("Found PuTTY in path: {0}", puttyPath, null);
-                return true;
+                goto found;
             }
             else
                 puttyPath = null;
         }
 
         return false;
+
+    found:
+        puttyPath = puttyPath.Trim();
+        return true;
     }
 
     private static void Putty(Uri uri)