From 1a024d2df5fc2bc5226b2797ee62974cdadaa398 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Sun, 6 Dec 2015 22:02:48 +0100 Subject: [PATCH] Fixed creating spurious folders on non-windows platforms. This fixes #1508. --- Duplicati/Library/AutoUpdater/UpdaterManager.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Duplicati/Library/AutoUpdater/UpdaterManager.cs b/Duplicati/Library/AutoUpdater/UpdaterManager.cs index 6a3345551..e9d6587b6 100644 --- a/Duplicati/Library/AutoUpdater/UpdaterManager.cs +++ b/Duplicati/Library/AutoUpdater/UpdaterManager.cs @@ -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;