[smuxi: 100/111] Frontend: don't rely on working directory for plink.exe detection



commit 31132814d977fcae4e61934b6ef89b8b11c0fefe
Author: Mirco Bauer <meebey meebey net>
Date:   Thu Feb 6 22:21:18 2014 +0100

    Frontend: don't rely on working directory for plink.exe detection
    
    Mono on Windows does not like this.

 src/Frontend/SshTunnelManager.cs |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/Frontend/SshTunnelManager.cs b/src/Frontend/SshTunnelManager.cs
index e082def..3f76dd2 100644
--- a/src/Frontend/SshTunnelManager.cs
+++ b/src/Frontend/SshTunnelManager.cs
@@ -25,6 +25,7 @@ using System.IO;
 using System.Net;
 using System.Net.Sockets;
 using System.Text.RegularExpressions;
+using System.Reflection;
 using SysDiag = System.Diagnostics;
 using Smuxi.Common;
 
@@ -133,8 +134,10 @@ namespace Smuxi.Frontend
 
             if (String.IsNullOrEmpty(f_Program)) {
                 // use plink by default if it's there
-                if (File.Exists("plink.exe")) {
-                    f_Program = "plink.exe";
+                var location = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
+                var plinkPath = Path.Combine(location, "plink.exe");
+                if (File.Exists(plinkPath)) {
+                    f_Program = plinkPath;
                 } else {
                     // TODO: find ssh
                     f_Program = "/usr/bin/ssh";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]