Fixed creating spurious folders on non-windows platforms.

This fixes #1508.
This commit is contained in:
Kenneth Skovhede
2015-12-06 22:02:48 +01:00
parent b9e3311dcb
commit 1a024d2df5
@@ -81,13 +81,17 @@ namespace Duplicati.Library.AutoUpdater
string installdir = null;
var attempts = new string[] {
System.IO.Path.Combine(InstalledBaseDir, "updates"),
System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), APPNAME, "updates"),
// Not defined on Non-Windows
string.IsNullOrWhiteSpace(System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles))
? null : System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), APPNAME, "updates"),
System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), APPNAME, "updates"),
System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), APPNAME, "updates"),
};
foreach(var p in attempts)
if (TestDirectoryIsWriteable(p))
if (!string.IsNullOrWhiteSpace(p) && TestDirectoryIsWriteable(p))
{
installdir = p;
break;