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:
Diffstat (limited to 'Duplicati/Server/SpecialFolders.cs')
-rw-r--r--Duplicati/Server/SpecialFolders.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/Duplicati/Server/SpecialFolders.cs b/Duplicati/Server/SpecialFolders.cs
index db40ec6df..518c3b345 100644
--- a/Duplicati/Server/SpecialFolders.cs
+++ b/Duplicati/Server/SpecialFolders.cs
@@ -109,6 +109,34 @@ namespace Duplicati.Server
Nodes = lst.ToArray();
}
+
+ internal static Dictionary<string, string> GetSourceNames(Serialization.Interface.IBackup backup)
+ {
+ var systemIO = Duplicati.Library.Snapshots.SnapshotUtility.SystemIO;
+
+ return backup.Sources.Distinct().Select(x => {
+ var sp = SpecialFolders.TranslateToDisplayString(x);
+ if (sp != null)
+ return new KeyValuePair<string, string>(x, sp);
+
+ x = SpecialFolders.ExpandEnvironmentVariables(x);
+ try {
+ var nx = x;
+ if (nx.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
+ nx = nx.Substring(0, nx.Length - 1);
+ var n = systemIO.PathGetFileName(nx);
+ if (!string.IsNullOrWhiteSpace(n))
+ return new KeyValuePair<string, string>(x, n);
+ } catch {
+ }
+
+ if (x.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()) && x.Length > 1)
+ return new KeyValuePair<string, string>(x, x.Substring(0, x.Length - 1).Substring(x.Substring(0, x.Length - 1).LastIndexOf("/") + 1));
+ else
+ return new KeyValuePair<string, string>(x, x);
+
+ }).ToDictionary(x => x.Key, x => x.Value);
+ }
}
}