diff options
author | verhoek <30193551+verhoek@users.noreply.github.com> | 2018-10-27 13:17:07 +0300 |
---|---|---|
committer | verhoek <30193551+verhoek@users.noreply.github.com> | 2018-10-27 13:17:07 +0300 |
commit | bc053df294672e4d3e44541e99c9875fc879c845 (patch) | |
tree | ec5212e890dcb30a99028f1b182cc24fc4d0eb56 /Duplicati/Library/AutoUpdater | |
parent | 73f80a99edb7232592a61d43967685cb18a0ae60 (diff) |
Moved basic IO helper functions to Library.IO.
Diffstat (limited to 'Duplicati/Library/AutoUpdater')
-rw-r--r-- | Duplicati/Library/AutoUpdater/Duplicati.Library.AutoUpdater.csproj | 4 | ||||
-rw-r--r-- | Duplicati/Library/AutoUpdater/Program.cs | 7 | ||||
-rw-r--r-- | Duplicati/Library/AutoUpdater/UpdaterManager.cs | 13 |
3 files changed, 15 insertions, 9 deletions
diff --git a/Duplicati/Library/AutoUpdater/Duplicati.Library.AutoUpdater.csproj b/Duplicati/Library/AutoUpdater/Duplicati.Library.AutoUpdater.csproj index 99c1279a9..2588f027f 100644 --- a/Duplicati/Library/AutoUpdater/Duplicati.Library.AutoUpdater.csproj +++ b/Duplicati/Library/AutoUpdater/Duplicati.Library.AutoUpdater.csproj @@ -67,6 +67,10 @@ <Project>{4D012CB1-4B92-47F4-89B7-BF80A73A2E99}</Project>
<Name>Duplicati.License</Name>
</ProjectReference>
+ <ProjectReference Include="..\IO\Duplicati.Library.IO.csproj">
+ <Project>{D63E53E4-A458-4C2F-914D-92F715F58ACF}</Project>
+ <Name>Duplicati.Library.IO</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="AutoUpdateAppName.txt" />
diff --git a/Duplicati/Library/AutoUpdater/Program.cs b/Duplicati/Library/AutoUpdater/Program.cs index d02781dd4..fd9d31ba1 100644 --- a/Duplicati/Library/AutoUpdater/Program.cs +++ b/Duplicati/Library/AutoUpdater/Program.cs @@ -18,7 +18,8 @@ using System;
using System.Linq;
using System.Collections.Generic;
-
+using Duplicati.Library.IO; + namespace Duplicati.Library.AutoUpdater
{
public static class Program
@@ -61,7 +62,7 @@ namespace Duplicati.Library.AutoUpdater {
var versions = UpdaterManager.FindInstalledVersions();
var selfdir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
- if (string.Equals(Library.Utility.Utility.AppendDirSeparator(selfdir), Library.Utility.Utility.AppendDirSeparator(UpdaterManager.InstalledBaseDir)))
+ if (string.Equals(Util.AppendDirSeparator(selfdir), Util.AppendDirSeparator(UpdaterManager.InstalledBaseDir)))
versions = versions.Union(new KeyValuePair<string, UpdateInfo>[] { new KeyValuePair<string, UpdateInfo>(selfdir, UpdaterManager.SelfVersion) });
Console.WriteLine(string.Join(Environment.NewLine, versions.Select(x => string.Format(" {0} {1} ({2})", (x.Value.Version == UpdaterManager.SelfVersion.Version ? "*" : "-"), x.Value.Displayname, x.Value.Version))));
return 0;
@@ -71,7 +72,7 @@ namespace Duplicati.Library.AutoUpdater {
var versions = UpdaterManager.FindInstalledVersions();
var selfdir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
- if (string.Equals(Library.Utility.Utility.AppendDirSeparator(selfdir), Library.Utility.Utility.AppendDirSeparator(UpdaterManager.InstalledBaseDir)))
+ if (string.Equals(Util.AppendDirSeparator(selfdir), Util.AppendDirSeparator(UpdaterManager.InstalledBaseDir)))
versions = versions.Union(new KeyValuePair<string, UpdateInfo>[] { new KeyValuePair<string, UpdateInfo>(selfdir, UpdaterManager.SelfVersion) });
Console.WriteLine(string.Join(Environment.NewLine, versions.Select(x => string.Format(" {0} {1} ({2}): {3}", (x.Value.Version == UpdaterManager.SelfVersion.Version ? "*" : "-"), x.Value.Displayname, x.Value.Version, UpdaterManager.VerifyUnpackedFolder(x.Key, x.Value) ? "Valid" : "*** Modified ***"))));
diff --git a/Duplicati/Library/AutoUpdater/UpdaterManager.cs b/Duplicati/Library/AutoUpdater/UpdaterManager.cs index 961d122e3..be0b9d890 100644 --- a/Duplicati/Library/AutoUpdater/UpdaterManager.cs +++ b/Duplicati/Library/AutoUpdater/UpdaterManager.cs @@ -21,7 +21,8 @@ using System.Collections.Generic; using System.IO; using System.Threading.Tasks;
using Duplicati.Library.Interface;
-
+using Duplicati.Library.IO; + namespace Duplicati.Library.AutoUpdater
{
public enum AutoUpdateStrategy
@@ -149,7 +150,7 @@ namespace Duplicati.Library.AutoUpdater var attempts = new List<string>();
// We do not want to install anything in the basedir, if the application is installed in "ProgramFiles"
- if (!string.IsNullOrWhiteSpace(programfiles) && !InstalledBaseDir.StartsWith(Library.Utility.Utility.AppendDirSeparator(programfiles), StringComparison.Ordinal))
+ if (!string.IsNullOrWhiteSpace(programfiles) && !InstalledBaseDir.StartsWith(Util.AppendDirSeparator(programfiles), StringComparison.Ordinal))
attempts.Add(System.IO.Path.Combine(InstalledBaseDir, "updates"));
if (Library.Utility.Utility.IsClientOSX)
@@ -510,7 +511,7 @@ namespace Duplicati.Library.AutoUpdater System.IO.Directory.CreateDirectory(targetfolder); - var tempfolderpath = Duplicati.Library.Utility.Utility.AppendDirSeparator(tempfolder); + var tempfolderpath = Util.AppendDirSeparator(tempfolder); var tempfolderlength = tempfolderpath.Length; // Would be nice, but does not work :( @@ -605,9 +606,9 @@ namespace Duplicati.Library.AutoUpdater var paths = update.Files.Where(x => !x.Ignore).ToDictionary(x => x.Path.Replace('/', System.IO.Path.DirectorySeparatorChar), Library.Utility.Utility.ClientFilenameStringComparer);
paths.Add(manifest.Path, manifest);
- var ignores = (from x in update.Files where x.Ignore select Library.Utility.Utility.AppendDirSeparator(x.Path.Replace('/', System.IO.Path.DirectorySeparatorChar))).ToList();
+ var ignores = (from x in update.Files where x.Ignore select Util.AppendDirSeparator(x.Path.Replace('/', System.IO.Path.DirectorySeparatorChar))).ToList();
- folder = Library.Utility.Utility.AppendDirSeparator(folder);
+ folder = Util.AppendDirSeparator(folder);
var baselen = folder.Length;
foreach (var file in Library.Utility.Utility.EnumerateFileSystemEntries(folder))
@@ -718,7 +719,7 @@ namespace Duplicati.Library.AutoUpdater var localManifest = remoteManifest.Clone();
localManifest.RemoteURLS = null;
- inputfolder = Duplicati.Library.Utility.Utility.AppendDirSeparator(inputfolder);
+ inputfolder = Util.AppendDirSeparator(inputfolder);
var baselen = inputfolder.Length;
var dirsep = System.IO.Path.DirectorySeparatorChar.ToString();
|