diff --git a/BuildTools/UpdateVersionStamp/Program.cs b/BuildTools/UpdateVersionStamp/Program.cs index 8c9729468..0a47a45fe 100644 --- a/BuildTools/UpdateVersionStamp/Program.cs +++ b/BuildTools/UpdateVersionStamp/Program.cs @@ -52,7 +52,7 @@ namespace UpdateVersionStamp if (!string.IsNullOrEmpty(opt.ignorefilter)) filter = new Duplicati.Library.Utility.FilterExpression(opt.ignorefilter, false); - Func isFile = (string x) => !x.EndsWith(DIR_SEP); + Func isFile = (string x) => !x.EndsWith(DIR_SEP); // TODO: fix this so that when x=="/" (i.e. unix root folder), isFile returns true var paths = Duplicati.Library.Utility.Utility.EnumerateFileSystemEntries(opt.sourcefolder, filter) .Where(x => isFile(x) && FILEMAP.ContainsKey(Path.GetFileName(x))) diff --git a/Duplicati/Library/Snapshots/LinuxSnapshot.cs b/Duplicati/Library/Snapshots/LinuxSnapshot.cs index bcec6e802..18cfccf0b 100644 --- a/Duplicati/Library/Snapshots/LinuxSnapshot.cs +++ b/Duplicati/Library/Snapshots/LinuxSnapshot.cs @@ -35,11 +35,6 @@ namespace Duplicati.Library.Snapshots /// public class LinuxSnapshot : ISnapshotService { - /// - /// A frequently used char-as-string - /// - protected readonly string DIR_SEP = System.IO.Path.DirectorySeparatorChar.ToString(); - protected readonly SystemIOLinux _sysIO = new SystemIOLinux(); /// @@ -460,7 +455,7 @@ namespace Duplicati.Library.Snapshots public string GetSymlinkTarget(string file) { var local = ConvertToSnapshotPath(FindSnapShotByLocalPath(file), file); - return UnixSupport.File.GetSymlinkTarget(local.EndsWith(DIR_SEP) ? local.Substring(0, local.Length - 1) : local); + return UnixSupport.File.GetSymlinkTarget(System.IO.Path.GetFullPath(local)); } /// @@ -481,7 +476,7 @@ namespace Duplicati.Library.Snapshots /// The file or folder to examine public bool IsBlockDevice(string file) { - var n = UnixSupport.File.GetFileType(file.EndsWith(DIR_SEP) ? file.Substring(0, file.Length - 1) : file); + var n = UnixSupport.File.GetFileType(System.IO.Path.GetFullPath(file)); switch (n) { case UnixSupport.File.FileType.Directory: @@ -501,7 +496,7 @@ namespace Duplicati.Library.Snapshots public string HardlinkTargetID(string path) { var local = ConvertToSnapshotPath(FindSnapShotByLocalPath(path), path); - local = local.EndsWith(DIR_SEP) ? local.Substring(0, local.Length - 1) : local; + local = System.IO.Path.GetFullPath(local); if (UnixSupport.File.GetHardlinkCount(local) <= 1) return null; diff --git a/Duplicati/Library/Snapshots/NoSnapshot.cs b/Duplicati/Library/Snapshots/NoSnapshot.cs index 6b2a28fe9..e2feb7e16 100644 --- a/Duplicati/Library/Snapshots/NoSnapshot.cs +++ b/Duplicati/Library/Snapshots/NoSnapshot.cs @@ -37,11 +37,6 @@ namespace Duplicati.Library.Snapshots /// protected string[] m_sources; - /// - /// A frequently used char-as-string - /// - protected readonly string DIR_SEP = System.IO.Path.DirectorySeparatorChar.ToString(); - /// /// Constructs a new backup snapshot, using all the required disks /// @@ -160,10 +155,7 @@ namespace Duplicati.Library.Snapshots /// The file or folder to examine public virtual System.IO.FileAttributes GetAttributes(string file) { - if (file.EndsWith(DIR_SEP)) - return System.IO.File.GetAttributes(file.Substring(0, file.Length - 1)); - else - return System.IO.File.GetAttributes(file); + return System.IO.File.GetAttributes(System.IO.Path.GetFullPath(file)); } /// diff --git a/Duplicati/Library/Snapshots/NoSnapshotLinux.cs b/Duplicati/Library/Snapshots/NoSnapshotLinux.cs index a2071ebff..12288f35a 100644 --- a/Duplicati/Library/Snapshots/NoSnapshotLinux.cs +++ b/Duplicati/Library/Snapshots/NoSnapshotLinux.cs @@ -45,10 +45,8 @@ namespace Duplicati.Library.Snapshots /// The symlink target public override string GetSymlinkTarget(string file) { - if (file.EndsWith(DIR_SEP)) - return UnixSupport.File.GetSymlinkTarget(file.Substring(0, file.Length - 1)); - else - return UnixSupport.File.GetSymlinkTarget(file); + return UnixSupport.File.GetSymlinkTarget( + System.IO.Path.GetFullPath(file) ); } /// @@ -68,7 +66,7 @@ namespace Duplicati.Library.Snapshots /// The file or folder to examine public override bool IsBlockDevice(string file) { - var n = UnixSupport.File.GetFileType(file.EndsWith(DIR_SEP) ? file.Substring(0, file.Length - 1) : file); + var n = UnixSupport.File.GetFileType(System.IO.Path.GetFullPath(file)); switch (n) { case UnixSupport.File.FileType.Directory: @@ -87,7 +85,7 @@ namespace Duplicati.Library.Snapshots /// The file or folder to examine public override string HardlinkTargetID(string path) { - path = path.EndsWith(DIR_SEP) ? path.Substring(0, path.Length - 1) : path; + path = System.IO.Path.GetFullPath(path); if (UnixSupport.File.GetHardlinkCount(path) <= 1) return null; diff --git a/Duplicati/Library/Snapshots/SystemIOLinux.cs b/Duplicati/Library/Snapshots/SystemIOLinux.cs index bd3395495..5cfbbab9d 100644 --- a/Duplicati/Library/Snapshots/SystemIOLinux.cs +++ b/Duplicati/Library/Snapshots/SystemIOLinux.cs @@ -24,11 +24,6 @@ namespace Duplicati.Library.Snapshots { public struct SystemIOLinux : ISystemIO { - /// - /// A frequently used char-as-string - /// - private static readonly string DIR_SEP = System.IO.Path.DirectorySeparatorChar.ToString(); - #region ISystemIO implementation public void DirectoryDelete(string path) { @@ -172,7 +167,7 @@ namespace Duplicati.Library.Snapshots public Dictionary GetMetadata(string file) { - var f = file.EndsWith(DIR_SEP) ? file.Substring(0, file.Length - 1) : file; + var f = System.IO.Path.GetFullPath(file); var dict = new Dictionary(); var n = UnixSupport.File.GetExtendedAttributes(f); @@ -193,7 +188,7 @@ namespace Duplicati.Library.Snapshots if (data == null) return; - var f = file.EndsWith(DIR_SEP) ? file.Substring(0, file.Length - 1) : file; + var f = System.IO.Path.GetFullPath(file); foreach(var x in data.Where(x => x.Key.StartsWith("unix-ext:")).Select(x => new KeyValuePair(x.Key.Substring("unix-ext:".Length), Convert.FromBase64String(x.Value)))) UnixSupport.File.SetExtendedAttribute(f, x.Key, x.Value); diff --git a/thirdparty/MegaApi/LICENSE.txt b/thirdparty/MegaApi/license.txt similarity index 100% rename from thirdparty/MegaApi/LICENSE.txt rename to thirdparty/MegaApi/license.txt