summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.BuildTasks
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-02-20 11:59:58 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2010-02-20 11:59:58 -0800
commit82e155ebfbd6c846078f62e43f34d29e579fe50c (patch)
tree5b964ae928ac7443b93cfe46ab40087824db763b /src/DotNetOpenAuth.BuildTasks
parentd032336a198665678ae481f5b3050575fb1a708d (diff)
downloadDotNetOpenAuth-82e155ebfbd6c846078f62e43f34d29e579fe50c.zip
DotNetOpenAuth-82e155ebfbd6c846078f62e43f34d29e579fe50c.tar.gz
DotNetOpenAuth-82e155ebfbd6c846078f62e43f34d29e579fe50c.tar.bz2
Fixd bug where some shortened filenames would be reserved names such as "con".
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks')
-rw-r--r--src/DotNetOpenAuth.BuildTasks/PathSegment.cs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/PathSegment.cs b/src/DotNetOpenAuth.BuildTasks/PathSegment.cs
index c727a07..56655ff 100644
--- a/src/DotNetOpenAuth.BuildTasks/PathSegment.cs
+++ b/src/DotNetOpenAuth.BuildTasks/PathSegment.cs
@@ -20,6 +20,7 @@ namespace DotNetOpenAuth.BuildTasks {
private readonly string originalName;
private string currentName;
private bool minimized;
+ private static readonly string[] ReservedFileNames = "CON PRN AUX CLOCK$ NUL COM0 COM1 COM2 COM3 COM4 COM5 COM6 COM7 COM8 COM9 LPT0 LPT1 LPT2 LPT3 LPT4 LPT5 LPT6 LPT7 LPT8 LPT9".Split(' ');
internal PathSegment() {
this.currentName = string.Empty;
@@ -232,7 +233,7 @@ namespace DotNetOpenAuth.BuildTasks {
Contract.Ensures(Contract.Result<string>().Length <= allowableLength);
string candidateName = string.Empty;
int i;
- for (i = -1; candidateName.Length == 0 || this.Siblings.Any(child => string.Equals(child.CurrentName, candidateName, StringComparison.OrdinalIgnoreCase)); i++) {
+ for (i = -1; candidateName.Length == 0 || ReservedFileNames.Contains(candidateName, StringComparer.OrdinalIgnoreCase) || this.Siblings.Any(child => string.Equals(child.CurrentName, candidateName, StringComparison.OrdinalIgnoreCase)); i++) {
string unique = i < 0 ? string.Empty : i.ToString("x");
if (allowableLength < unique.Length) {
throw new InvalidOperationException("Unable to shorten path sufficiently to fit constraints.");