diff options
author | Dean Ferreyra <dean@octw.com> | 2021-11-10 09:34:35 +0300 |
---|---|---|
committer | Dean Ferreyra <dean@octw.com> | 2021-11-10 09:50:41 +0300 |
commit | 158614d59a7a6cf69ea964ac1b7a4e9c91b66fc2 (patch) | |
tree | 8ceef1e09a88d569e6e8a475c3dab0e0cbc4ac50 /Duplicati/Library/Common/IO | |
parent | 423921d1c2529be9f6f8770767a7ab5f93710c23 (diff) |
Refactor \\?\ prefix tests, rename source files, plus other review issues
Diffstat (limited to 'Duplicati/Library/Common/IO')
-rwxr-xr-x | Duplicati/Library/Common/IO/Path.cs (renamed from Duplicati/Library/Common/IO/DotNetRuntime.System.IO.Path.Windows.cs) | 0 | ||||
-rwxr-xr-x | Duplicati/Library/Common/IO/PathInternal.Windows.cs (renamed from Duplicati/Library/Common/IO/DotNetRuntime.System.IO.PathInternal.Windows.cs) | 0 | ||||
-rw-r--r-- | Duplicati/Library/Common/IO/SystemIOWindows.cs | 32 |
3 files changed, 18 insertions, 14 deletions
diff --git a/Duplicati/Library/Common/IO/DotNetRuntime.System.IO.Path.Windows.cs b/Duplicati/Library/Common/IO/Path.cs index 6a830a955..6a830a955 100755 --- a/Duplicati/Library/Common/IO/DotNetRuntime.System.IO.Path.Windows.cs +++ b/Duplicati/Library/Common/IO/Path.cs diff --git a/Duplicati/Library/Common/IO/DotNetRuntime.System.IO.PathInternal.Windows.cs b/Duplicati/Library/Common/IO/PathInternal.Windows.cs index 75a117392..75a117392 100755 --- a/Duplicati/Library/Common/IO/DotNetRuntime.System.IO.PathInternal.Windows.cs +++ b/Duplicati/Library/Common/IO/PathInternal.Windows.cs diff --git a/Duplicati/Library/Common/IO/SystemIOWindows.cs b/Duplicati/Library/Common/IO/SystemIOWindows.cs index 53a0ceb33..52f316576 100644 --- a/Duplicati/Library/Common/IO/SystemIOWindows.cs +++ b/Duplicati/Library/Common/IO/SystemIOWindows.cs @@ -47,22 +47,26 @@ namespace Duplicati.Library.Common.IO // For example: \\?\C:\Temp\foo.txt or \\?\UNC\example.com\share\foo.txt
return path;
}
- else if (IsPrefixedWithBasicUNC(path) && !HasRelativePathComponents(path))
- {
- // For example: \\example.com\share\foo.txt or //example.com/share/foo.txt
- return UNCPREFIX_SERVER + ConvertSlashes(path.Substring(PATHPREFIX_SERVER.Length));
- }
- else if (DotNetRuntimePathWindows.IsPathFullyQualified(path) && !HasRelativePathComponents(path))
- {
- // For example: C:\Temp\foo.txt or C:/Temp/foo.txt
- return UNCPREFIX + ConvertSlashes(path);
- }
else
{
- // A relative path or a fully qualified path with relative
- // path components so the UNC prefix cannot be applied.
- // For example: foo.txt or C:\Temp\..\foo.txt
- return path;
+ var hasRelativePathComponents = HasRelativePathComponents(path);
+ if (IsPrefixedWithBasicUNC(path) && !hasRelativePathComponents)
+ {
+ // For example: \\example.com\share\foo.txt or //example.com/share/foo.txt
+ return UNCPREFIX_SERVER + ConvertSlashes(path.Substring(PATHPREFIX_SERVER.Length));
+ }
+ else if (DotNetRuntimePathWindows.IsPathFullyQualified(path) && !hasRelativePathComponents)
+ {
+ // For example: C:\Temp\foo.txt or C:/Temp/foo.txt
+ return UNCPREFIX + ConvertSlashes(path);
+ }
+ else
+ {
+ // A relative path or a fully qualified path with relative
+ // path components so the UNC prefix cannot be applied.
+ // For example: foo.txt or C:\Temp\..\foo.txt
+ return path;
+ }
}
}
|