diff --git a/Duplicati/Library/Utility/Utility.cs b/Duplicati/Library/Utility/Utility.cs index 12d42bf21..78da0a201 100644 --- a/Duplicati/Library/Utility/Utility.cs +++ b/Duplicati/Library/Utility/Utility.cs @@ -977,13 +977,13 @@ namespace Duplicati.Library.Utility public static readonly string HOME_PATH = Environment.GetFolderPath(IsClientLinux ? Environment.SpecialFolder.Personal : Environment.SpecialFolder.UserProfile); /// - /// Expands environment variables, including the tilde character + /// Expands environment variables. /// /// The expanded string. /// The string to expand. public static string ExpandEnvironmentVariables(string str) { - return Environment.ExpandEnvironmentVariables(str.Replace("~", HOME_PATH)); + return Environment.ExpandEnvironmentVariables(str); } /// @@ -997,7 +997,7 @@ namespace Duplicati.Library.Utility private static readonly Regex ENVIRONMENT_VARIABLE_MATCHER_LINUX = new Regex(@"\$(?\w+)|(\{(?[^\}]+)\})"); /// - /// Expands environment variables, including the tilde character, in a RegExp safe format + /// Expands environment variables in a RegExp safe format /// /// The expanded string. /// The string to expand. @@ -1012,9 +1012,7 @@ namespace Duplicati.Library.Utility // TODO: Should we switch to using the native format, instead of following the Windows scheme? //IsClientLinux ? ENVIRONMENT_VARIABLE_MATCHER_LINUX : ENVIRONMENT_VARIABLE_MATCHER_WINDOWS - ENVIRONMENT_VARIABLE_MATCHER_WINDOWS - .Replace(str.Replace("~", Regex.Escape(HOME_PATH)), (m) => - Regex.Escape(lookup(m.Groups["name"].Value))); + ENVIRONMENT_VARIABLE_MATCHER_WINDOWS.Replace(str, (m) => Regex.Escape(lookup(m.Groups["name"].Value))); } /// diff --git a/Duplicati/UnitTest/BasicSetupHelper.cs b/Duplicati/UnitTest/BasicSetupHelper.cs index ce045a3da..f039f2cb8 100644 --- a/Duplicati/UnitTest/BasicSetupHelper.cs +++ b/Duplicati/UnitTest/BasicSetupHelper.cs @@ -29,7 +29,7 @@ namespace Duplicati.UnitTest /// protected static readonly string BASEFOLDER = string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("UNITTEST_BASEFOLDER")) - ? Library.Utility.Utility.ExpandEnvironmentVariables(Path.Combine("~", "testdata")) + ? Path.Combine(Library.Utility.Utility.HOME_PATH, "testdata") : Environment.GetEnvironmentVariable("UNITTEST_BASEFOLDER"); /// diff --git a/Duplicati/UnitTest/GeneralBlackBoxTesting.cs b/Duplicati/UnitTest/GeneralBlackBoxTesting.cs index 9143d128f..fb9e508ec 100644 --- a/Duplicati/UnitTest/GeneralBlackBoxTesting.cs +++ b/Duplicati/UnitTest/GeneralBlackBoxTesting.cs @@ -29,7 +29,7 @@ namespace Duplicati.UnitTest private static readonly string SOURCE_FOLDERS = Path.Combine( string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("UNITTEST_BASEFOLDER")) - ? Library.Utility.Utility.ExpandEnvironmentVariables(Path.Combine("~", "testdata")) + ? Path.Combine(Library.Utility.Utility.HOME_PATH, "testdata") : Environment.GetEnvironmentVariable("UNITTEST_BASEFOLDER") , "DSMCBE"); diff --git a/Duplicati/UnitTest/SVNCheckoutsTest.cs b/Duplicati/UnitTest/SVNCheckoutsTest.cs index 74107abf4..3416c09e0 100644 --- a/Duplicati/UnitTest/SVNCheckoutsTest.cs +++ b/Duplicati/UnitTest/SVNCheckoutsTest.cs @@ -99,11 +99,6 @@ namespace Duplicati.UnitTest where !string.IsNullOrWhiteSpace(x) select Library.Utility.Utility.ExpandEnvironmentVariables(x)).ToArray(); - //Expand the tilde to home folder on Linux/OSX - if (Utility.IsClientLinux) - folders = (from x in folders - select x.Replace("~", Environment.GetFolderPath(Environment.SpecialFolder.Personal))).ToArray(); - foreach (var f in folders) foreach (var n in f.Split(new char[] { System.IO.Path.PathSeparator }, StringSplitOptions.RemoveEmptyEntries)) if (!System.IO.Directory.Exists(n))