controller: still try to guess the key name if the user changes the email address in config.xml

This commit is contained in:
Hylke Bons 2012-01-18 00:53:26 +00:00
parent 5267138693
commit 230ec0bb6a

View file

@ -748,14 +748,25 @@ namespace SparkleShare {
// so all activity is done with this key // so all activity is done with this key
public void AddKey () public void AddKey ()
{ {
string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath); string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath);
string key_file_name = "sparkleshare." + UserEmail + ".key"; string key_file_name = "sparkleshare." + UserEmail + ".key";
string key_file_path = Path.Combine (keys_path, key_file_name);
if (!File.Exists (key_file_path)) {
foreach (string file_name in Directory.GetFiles (keys_path)) {
if (file_name.StartsWith ("sparkleshare") &&
file_name.EndsWith (".key")) {
key_file_path = Path.Combine (keys_path, file_name);
}
}
}
Process process = new Process (); Process process = new Process ();
process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false; process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = "ssh-add"; process.StartInfo.FileName = "ssh-add";
process.StartInfo.Arguments = "\"" + Path.Combine (keys_path, key_file_name) + "\""; process.StartInfo.Arguments = "\"" + key_file_path + "\"";
process.Start (); process.Start ();
process.WaitForExit (); process.WaitForExit ();