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:
authorKenneth Hsu <kennethhsu@gmail.com>2019-10-19 20:56:21 +0300
committerKenneth Hsu <kennethhsu@gmail.com>2019-10-19 23:59:22 +0300
commit2aa76881a51ce91762f7caabcc114434647532c2 (patch)
tree19f18239244918e0314b8282f7efa89c72acb2c6 /Duplicati/Library/Common/IO
parent91505e62238a68f020d99bd9a7c1a2be8e3b25cf (diff)
Mark fields that don't need to be reassigned as readonly.
This makes it explicit at compile-time that these fields should not be reassigned outside the constructor.
Diffstat (limited to 'Duplicati/Library/Common/IO')
-rw-r--r--Duplicati/Library/Common/IO/SystemIOWindows.cs74
1 files changed, 37 insertions, 37 deletions
diff --git a/Duplicati/Library/Common/IO/SystemIOWindows.cs b/Duplicati/Library/Common/IO/SystemIOWindows.cs
index 31a85b499..d83298e6f 100644
--- a/Duplicati/Library/Common/IO/SystemIOWindows.cs
+++ b/Duplicati/Library/Common/IO/SystemIOWindows.cs
@@ -35,7 +35,7 @@ namespace Duplicati.Library.Common.IO
private static bool IsPathTooLong(string path)
{
- return path.StartsWith(UNCPREFIX, StringComparison.Ordinal) || path.StartsWith(UNCPREFIX_SERVER, StringComparison.Ordinal) || path.Length > 260;
+ return path.StartsWith(UNCPREFIX, StringComparison.Ordinal) || path.StartsWith(UNCPREFIX_SERVER, StringComparison.Ordinal) || path.Length > 260;
}
public static string PrefixWithUNC(string path)
@@ -58,12 +58,12 @@ namespace Duplicati.Library.Common.IO
private class FileSystemAccess
{
- public FileSystemRights Rights;
- public AccessControlType ControlType;
- public string SID;
- public bool Inherited;
- public InheritanceFlags Inheritance;
- public PropagationFlags Propagation;
+ public readonly FileSystemRights Rights;
+ public readonly AccessControlType ControlType;
+ public readonly string SID;
+ public readonly bool Inherited;
+ public readonly InheritanceFlags Inheritance;
+ public readonly PropagationFlags Propagation;
public FileSystemAccess()
{
@@ -91,11 +91,11 @@ namespace Duplicati.Library.Common.IO
}
}
- private static Newtonsoft.Json.JsonSerializer _cachedSerializer;
-
- private Newtonsoft.Json.JsonSerializer Serializer
- {
- get
+ private static Newtonsoft.Json.JsonSerializer _cachedSerializer;
+
+ private Newtonsoft.Json.JsonSerializer Serializer
+ {
+ get
{
if (_cachedSerializer != null)
{
@@ -106,8 +106,8 @@ namespace Duplicati.Library.Common.IO
new Newtonsoft.Json.JsonSerializerSettings { Culture = System.Globalization.CultureInfo.InvariantCulture });
return _cachedSerializer;
- }
- }
+ }
+ }
private string SerializeObject<T>(T o)
{
@@ -379,13 +379,13 @@ namespace Duplicati.Library.Common.IO
p => Alphaleonis.Win32.Filesystem.Directory.Delete(p, recursive),
path, true);
}
-
- public string GetPathRoot(string path)
+
+ public string GetPathRoot(string path)
{
- return PathTooLongFuncWrapper(Path.GetPathRoot, AlphaFS.Path.GetPathRoot, path, false);
+ return PathTooLongFuncWrapper(Path.GetPathRoot, AlphaFS.Path.GetPathRoot, path, false);
}
- public string[] GetDirectories(string path)
+ public string[] GetDirectories(string path)
{
return PathTooLongFuncWrapper(Directory.GetDirectories, AlphaFS.Directory.GetDirectories, path, false);
}
@@ -408,25 +408,25 @@ namespace Duplicati.Library.Common.IO
public DateTime GetLastWriteTimeUtc(string path)
{
return PathTooLongFuncWrapper(Directory.GetLastWriteTimeUtc, AlphaFS.File.GetLastWriteTimeUtc, path, false);
- }
-
- public IEnumerable<string> EnumerateDirectories(string path)
- {
+ }
+
+ public IEnumerable<string> EnumerateDirectories(string path)
+ {
return PathTooLongFuncWrapper(Directory.EnumerateDirectories, AlphaFS.Directory.EnumerateDirectories, path, false);
- }
-
- public void FileCopy(string source, string target, bool overwrite)
- {
+ }
+
+ public void FileCopy(string source, string target, bool overwrite)
+ {
// We do not check if path is too long on target. If so, then we catch an exception.
- PathTooLongActionWrapper(p => File.Copy(p, target, overwrite), p => AlphaFS.File.Copy(p, target, overwrite), source, false);
- }
-
- public string PathGetFullPath(string path)
- {
+ PathTooLongActionWrapper(p => File.Copy(p, target, overwrite), p => AlphaFS.File.Copy(p, target, overwrite), source, false);
+ }
+
+ public string PathGetFullPath(string path)
+ {
return PathTooLongFuncWrapper(System.IO.Path.GetFullPath, AlphaFS.Path.GetFullPath, path, false);
- }
-
- public IFileEntry DirectoryEntry(string path)
+ }
+
+ public IFileEntry DirectoryEntry(string path)
{
IFileEntry DirectoryEntryNative(string p) {
var dInfo = new DirectoryInfo(p);
@@ -446,9 +446,9 @@ namespace Duplicati.Library.Common.IO
}
return PathTooLongFuncWrapper(DirectoryEntryNative, DirectoryEntryAlphaFS, path, false);
- }
-
- public IFileEntry FileEntry(string path)
+ }
+
+ public IFileEntry FileEntry(string path)
{
IFileEntry FileEntryNative(string p)
{