diff options
author | Kenneth Hsu <kennethhsu@gmail.com> | 2017-11-26 21:53:14 +0300 |
---|---|---|
committer | Kenneth Hsu <kennethhsu@gmail.com> | 2017-11-26 22:19:54 +0300 |
commit | 8810e0130d3857cadc9269367f0e80f6434b44af (patch) | |
tree | c28108b89bbea8510023b937f00ecee9c4bb517c /Duplicati/CommandLine/Commands.cs | |
parent | 6f5709e0d35a9e5bcc6379c265ae50627fba5b82 (diff) |
Make string comparisons use ordinal (binary) sort rules.
These string comparisons should not be culture-aware.
Diffstat (limited to 'Duplicati/CommandLine/Commands.cs')
-rw-r--r-- | Duplicati/CommandLine/Commands.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Duplicati/CommandLine/Commands.cs b/Duplicati/CommandLine/Commands.cs index ed248d367..30c3fe662 100644 --- a/Duplicati/CommandLine/Commands.cs +++ b/Duplicati/CommandLine/Commands.cs @@ -260,7 +260,7 @@ namespace Duplicati.CommandLine options["version"] = v.ToString();
}
}
- else if (args[0].IndexOfAny(new char[] { '*', '?' }) < 0 && !args[0].StartsWith("["))
+ else if (args[0].IndexOfAny(new char[] { '*', '?' }) < 0 && !args[0].StartsWith("[", StringComparison.Ordinal))
{
try
{
@@ -277,7 +277,7 @@ namespace Duplicati.CommandLine // Prefix all filenames with "*/" so we search all folders
for(var ix = 0; ix < args.Count; ix++)
- if (args[ix].IndexOfAny(new char[] { '*', '?', System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar }) < 0 && !args[ix].StartsWith("["))
+ if (args[ix].IndexOfAny(new char[] { '*', '?', System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar }) < 0 && !args[ix].StartsWith("[", StringComparison.Ordinal))
args[ix] = "*" + System.IO.Path.DirectorySeparatorChar.ToString() + args[ix];
// Support for not adding the --auth-username if possible
@@ -360,7 +360,7 @@ namespace Duplicati.CommandLine var f = res.Filesets.First();
outwriter.WriteLine("Listing contents {0} ({1}):", f.Version, f.Time);
foreach(var e in res.Files)
- outwriter.WriteLine("{0} {1}", e.Path, e.Path.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()) ? "" : "(" + Library.Utility.Utility.FormatSizeString(e.Sizes.First()) + ")");
+ outwriter.WriteLine("{0} {1}", e.Path, e.Path.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal) ? "" : "(" + Library.Utility.Utility.FormatSizeString(e.Sizes.First()) + ")");
}
else
{
@@ -444,12 +444,12 @@ namespace Duplicati.CommandLine // Prefix all filenames with "*/" so we search all folders
for (var ix = 0; ix < args.Count; ix++)
- if (args[ix].IndexOfAny(new char[] { '*', '?', System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar }) < 0 && !args[ix].StartsWith("["))
+ if (args[ix].IndexOfAny(new char[] { '*', '?', System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar }) < 0 && !args[ix].StartsWith("[", StringComparison.Ordinal))
args[ix] = "*" + System.IO.Path.DirectorySeparatorChar.ToString() + args[ix];
// suffix all folders with "*" so we restore all contents in the folder
for (var ix = 0; ix < args.Count; ix++)
- if (args[ix].IndexOfAny(new char[] { '*', '?' }) < 0 && !args[ix].StartsWith("[") && args[ix].EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
+ if (args[ix].IndexOfAny(new char[] { '*', '?' }) < 0 && !args[ix].StartsWith("[", StringComparison.Ordinal) && args[ix].EndsWith(System.IO.Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
args[ix] += "*";
var output = new ConsoleOutput(outwriter, options);
|