Skip to content

Commit 5dc784b

Browse files
committed
Adjusted using conditional compilation for 1.1 and 2.0 frameworks.
1 parent 4bd411e commit 5dc784b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Zip/ZipNameTransform.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,22 @@ public ZipNameTransform(bool useRelativePaths, string trimPrefix)
104104
/// </summary>
105105
static ZipNameTransform()
106106
{
107-
int howMany = Path.InvalidPathChars.Length + 2;
107+
char[] invalidPathChars;
108+
#if NET_VER_1
109+
invalidPathChars = Path.InvalidPathChars;
110+
#else
111+
invalidPathChars = Path.GetInvalidPathChars();
112+
#endif
113+
int howMany = invalidPathChars.Length + 2;
108114

109115
InvalidEntryCharsRelaxed = new char[howMany];
110-
Array.Copy(Path.InvalidPathChars, 0, InvalidEntryCharsRelaxed, 0, Path.InvalidPathChars.Length);
116+
Array.Copy(invalidPathChars, 0, InvalidEntryCharsRelaxed, 0, invalidPathChars.Length);
111117
InvalidEntryCharsRelaxed[howMany - 1] = '*';
112118
InvalidEntryCharsRelaxed[howMany - 2] = '?';
113119

114-
howMany = Path.InvalidPathChars.Length + 4;
120+
howMany = invalidPathChars.Length + 4;
115121
InvalidEntryChars = new char[howMany];
116-
Array.Copy(Path.InvalidPathChars, 0, InvalidEntryChars, 0, Path.InvalidPathChars.Length);
122+
Array.Copy(invalidPathChars, 0, InvalidEntryChars, 0, invalidPathChars.Length);
117123
InvalidEntryChars[howMany - 1] = ':';
118124
InvalidEntryChars[howMany - 2] = '\\';
119125
InvalidEntryChars[howMany - 3] = '*';

0 commit comments

Comments
 (0)