Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwarwickmm <warwickmm@users.noreply.github.com>2020-07-26 03:48:50 +0300
committerGitHub <noreply@github.com>2020-07-26 03:48:50 +0300
commite7daffcb3105c0c43770cc79084740016ba44170 (patch)
tree5a39b44603189072e9c25502d16e682528a0fc11 /Duplicati/CommandLine
parent670b1666d711c3ea7a240cc52e7d7cc55fcf7d47 (diff)
parentd1547020202025f96391a39c28e0351220b6d702 (diff)
Merge pull request #4256 from dferreyra/support_problematic_windows_paths
Support problematic Windows paths that end with spaces or periods.
Diffstat (limited to 'Duplicati/CommandLine')
-rw-r--r--Duplicati/CommandLine/RecoveryTool/Restore.cs14
1 files changed, 8 insertions, 6 deletions
diff --git a/Duplicati/CommandLine/RecoveryTool/Restore.cs b/Duplicati/CommandLine/RecoveryTool/Restore.cs
index e4436bec6..b2fc5282e 100644
--- a/Duplicati/CommandLine/RecoveryTool/Restore.cs
+++ b/Duplicati/CommandLine/RecoveryTool/Restore.cs
@@ -25,6 +25,8 @@ namespace Duplicati.CommandLine.RecoveryTool
{
public static class Restore
{
+ private static readonly ISystemIO systemIO = SystemIO.IO_OS;
+
public static int Run(List<string> args, Dictionary<string, string> options, Library.Utility.IFilter filter)
{
if (args.Count != 2 && args.Count != 3)
@@ -158,8 +160,8 @@ namespace Duplicati.CommandLine.RecoveryTool
try
{
var targetfile = MapToRestorePath(f.Path, largestprefix, targetpath);
- if (!Directory.Exists(Path.GetDirectoryName(targetfile)))
- Directory.CreateDirectory(Path.GetDirectoryName(targetfile));
+ if (!systemIO.DirectoryExists(systemIO.PathGetDirectoryName(targetfile)))
+ systemIO.DirectoryCreate(systemIO.PathGetDirectoryName(targetfile));
Console.Write("{0}: {1} ({2})", i, targetfile, Library.Utility.Utility.FormatSizeString(f.Size));
@@ -214,12 +216,12 @@ namespace Duplicati.CommandLine.RecoveryTool
if (fh == f.Hash)
{
Console.WriteLine(" done!");
- File.Copy(tf, targetfile, true);
+ systemIO.FileCopy(tf, targetfile, true);
}
else
{
Console.Write(" - Restored file hash mismatch");
- if (File.Exists(targetfile))
+ if (systemIO.FileExists(targetfile))
Console.WriteLine(" - not overwriting existing file: {0}", targetfile);
else
Console.WriteLine(" - restoring file in damaged condition");
@@ -254,10 +256,10 @@ namespace Duplicati.CommandLine.RecoveryTool
if (path.Substring(1, 1) == ":")
prefixpath = path.Substring(0, 1) + path.Substring(2);
- return Path.Combine(restorepath, prefixpath);
+ return systemIO.PathCombine(restorepath, prefixpath);
}
- return Path.Combine(restorepath, path.Substring(prefixpath.Length));
+ return systemIO.PathCombine(restorepath, path.Substring(prefixpath.Length));
}