From 9df0fd644058c22e58cdf1d1c77197e9c34310f4 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 5 Jun 2011 19:59:48 +0100 Subject: [PATCH] Detect the correct .shh path on Windows --- SparkleLib/SparkleFetcherBase.cs | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index e348d972..8a48e818 100644 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -113,11 +113,17 @@ namespace SparkleLib { private void DisableHostKeyCheckingForHost (string host) { - string ssh_config_file_path = SparkleHelpers.CombineMore ( - SparklePaths.HomePath, ".ssh", "config"); + string path = SparklePaths.HomePath; - string ssh_config = Environment.NewLine + "Host " + host + - Environment.NewLine + "\tStrictHostKeyChecking no"; + if (!(SparkleBackend.Platform == PlatformID.Unix || + SparkleBackend.Platform == PlatformID.MacOSX)) { + + path = Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%"); + } + + string ssh_config_file_path = SparkleHelpers.CombineMore (path, ".ssh", "config"); + string ssh_config = Environment.NewLine + "Host " + host + + Environment.NewLine + "\tStrictHostKeyChecking no"; if (File.Exists (ssh_config_file_path)) { TextWriter writer = File.AppendText (ssh_config_file_path); @@ -140,11 +146,17 @@ namespace SparkleLib { private void EnableHostKeyCheckingForHost (string host) { - string ssh_config_file_path = SparkleHelpers.CombineMore ( - SparklePaths.HomePath, ".ssh", "config"); + string path = SparklePaths.HomePath; - string ssh_config = Environment.NewLine + "Host " + host + - Environment.NewLine + "\tStrictHostKeyChecking no"; + if (!(SparkleBackend.Platform == PlatformID.Unix || + SparkleBackend.Platform == PlatformID.MacOSX)) { + + path = Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%"); + } + + string ssh_config_file_path = SparkleHelpers.CombineMore (path, ".ssh", "config"); + string ssh_config = Environment.NewLine + "Host " + host + + Environment.NewLine + "\tStrictHostKeyChecking no"; if (File.Exists (ssh_config_file_path)) { StreamReader reader = new StreamReader (ssh_config_file_path);