Fixes for issue #59.

Added a WaitCursor for the test button in the wizard pages.
Fixed an issue with environment variables in the SSH backend.

git-svn-id: https://duplicati.googlecode.com/svn/trunk@179 59da171f-624f-0410-aa54-27559c288bec
This commit is contained in:
kenneth.skovhede@gmail.com
2009-05-23 12:29:10 +00:00
parent 8904d8f3ea
commit a7fa2c4a2f
5 changed files with 33 additions and 5 deletions
@@ -172,8 +172,10 @@ namespace Duplicati.GUI.Wizard_pages.Backends.FTP
{
if (ValidateForm())
{
Cursor c = this.Cursor;
try
{
this.Cursor = Cursors.WaitCursor;
System.Data.LightDatamodel.IDataFetcherCached con = new System.Data.LightDatamodel.DataFetcherNested(Program.DataConnection);
Datamodel.Backends.FTP ftp = new Duplicati.Datamodel.Backends.FTP(con.Add<Task>());
@@ -196,6 +198,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.FTP
{
MessageBox.Show(this, "Connection Failed: " + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Cursor = c;
}
}
@@ -185,8 +185,10 @@ namespace Duplicati.GUI.Wizard_pages.Backends.S3
{
if (ValidateForm())
{
Cursor c = this.Cursor;
try
{
this.Cursor = Cursors.WaitCursor;
System.Data.LightDatamodel.IDataFetcherCached con = new System.Data.LightDatamodel.DataFetcherNested(Program.DataConnection);
Datamodel.Backends.S3 s3 = new Duplicati.Datamodel.Backends.S3(con.Add<Task>());
@@ -219,6 +221,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.S3
MessageBox.Show(this, "Connection Failed: " + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Cursor = c;
}
}
@@ -122,8 +122,10 @@ namespace Duplicati.GUI.Wizard_pages.Backends.SSH
{
if (ValidateForm())
{
Cursor c = this.Cursor;
try
{
this.Cursor = Cursors.WaitCursor;
System.Data.LightDatamodel.IDataFetcherCached con = new System.Data.LightDatamodel.DataFetcherNested(Program.DataConnection);
Datamodel.Backends.SSH ssh = new Duplicati.Datamodel.Backends.SSH(con.Add<Task>());
@@ -139,6 +141,9 @@ namespace Duplicati.GUI.Wizard_pages.Backends.SSH
Dictionary<string, string> options = new Dictionary<string, string>();
ssh.GetOptions(options);
//Make sure that "testing" always produce a log
options.Add("debug-to-console", "");
string[] files = Duplicati.Library.Main.Interface.List(target, options);
MessageBox.Show(this, "Connection succeeded!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
@@ -149,6 +154,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.SSH
MessageBox.Show(this, "Connection Failed: " + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Cursor = c;
}
}
@@ -185,8 +185,10 @@ namespace Duplicati.GUI.Wizard_pages.Backends.WebDAV
{
if (ValidateForm())
{
Cursor c = this.Cursor;
try
{
this.Cursor = Cursors.WaitCursor;
System.Data.LightDatamodel.IDataFetcherCached con = new System.Data.LightDatamodel.DataFetcherNested(Program.DataConnection);
Datamodel.Backends.WEBDAV webdav = new Duplicati.Datamodel.Backends.WEBDAV(con.Add<Datamodel.Task>());
@@ -210,6 +212,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.WebDAV
{
MessageBox.Show(this, "Connection Failed: " + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Cursor = c;
}
}
+18 -5
View File
@@ -71,7 +71,20 @@ namespace Duplicati.Library.Backend
}
}
m_path = u.AbsolutePath.Substring(1);
m_path = u.AbsolutePath;
if (m_isLinux)
{
//HACK: "AbsolutePath" strips extra slashes under mono, so we re-add them here
int ix = url.IndexOf(m_path);
if (ix > 0 && url[ix - 1] == '/')
m_path = "/" + m_path;
}
//Remove 1 leading slash so server/path is mapped to "path",
// and server//path is mapped to "/path"
m_path = m_path.Substring(1);
if (!m_path.EndsWith("/"))
m_path += "/";
@@ -81,7 +94,7 @@ namespace Duplicati.Library.Backend
m_sftp = options["sftp-command"];
else
{
if (System.Environment.OSVersion.Platform == PlatformID.Unix || System.Environment.OSVersion.Platform == PlatformID.MacOSX)
if (m_isLinux)
m_sftp = "sftp";
else
m_sftp = "psftp.exe";
@@ -250,7 +263,7 @@ namespace Duplicati.Library.Backend
{
get
{
return "This backend can read and write data to an SSH based backend, using SCP and SFTP. Allowed formats are \"ssh://hostname/folder\" or \"ssh://username:password@hostname/folder\". NOTE: This backend does not support throttling uploads or downloads, and requires that sftp and scp are installed (using putty for windows).";
return "This backend can read and write data to an SSH based backend, using SFTP. Allowed formats are \"ssh://hostname/folder\" or \"ssh://username:password@hostname/folder\". NOTE: This backend does not support throttling uploads or downloads, and requires that sftp is installed (using putty for windows).";
}
}
@@ -307,11 +320,11 @@ namespace Duplicati.Library.Backend
//we wrap the command with expect, which allows us to use stdin/stdout
p.StartInfo.FileName = "expect";
p.StartInfo.Arguments = @"-c ""set timeout 30"" -c ""spawn \""" + m_sftp + @"\"" " + server + " " + m_ssh_options + @""" -c ""interact {~~}""";
p.StartInfo.Arguments = @"-c ""set timeout 30"" -c ""spawn \""" + System.Environment.ExpandEnvironmentVariables(m_sftp) + @"\"" " + server + " " + m_ssh_options + @""" -c ""interact {~~}""";
}
else
{
p.StartInfo.FileName = m_sftp;
p.StartInfo.FileName = System.Environment.ExpandEnvironmentVariables(m_sftp);
p.StartInfo.Arguments = server + " " + m_ssh_options;
}