From 9acb5d6f68f7e0590e8be2542efdc8cc241dcec0 Mon Sep 17 00:00:00 2001 From: Alex Ghiondea Date: Thu, 19 May 2016 12:17:41 -0700 Subject: [PATCH] Checking in on behalf of JKuhne Fixing build break in K caused by the long file path work. [tfs-changeset: 1606374] --- src/mscorlib/src/System/IO/LongPathHelper.cs | 1 + src/mscorlib/src/System/IO/Path.cs | 9 +++++++-- src/mscorlib/src/System/IO/PathHelper.cs | 3 +++ src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mscorlib/src/System/IO/LongPathHelper.cs b/src/mscorlib/src/System/IO/LongPathHelper.cs index 41cbb15..9f99d80 100644 --- a/src/mscorlib/src/System/IO/LongPathHelper.cs +++ b/src/mscorlib/src/System/IO/LongPathHelper.cs @@ -377,6 +377,7 @@ namespace System.IO } } + [System.Security.SecuritySafeCritical] private static string TryExpandShortFileName(StringBuffer outputBuffer, string originalPath) { // We'll have one of a few cases by now (the normalized path will have already: diff --git a/src/mscorlib/src/System/IO/Path.cs b/src/mscorlib/src/System/IO/Path.cs index 10da27c..a54e559 100644 --- a/src/mscorlib/src/System/IO/Path.cs +++ b/src/mscorlib/src/System/IO/Path.cs @@ -104,12 +104,11 @@ namespace System.IO { #endif // !PLATFORM_UNIX - // Make this public sometime. // The max total path is 260, and the max individual component length is 255. // For example, D:\<256 char file name> isn't legal, even though it's under 260 chars. internal static readonly int MaxPath = PathInternal.MaxShortPath; - private static readonly int MaxDirectoryLength = 255; + private static readonly int MaxDirectoryLength = PathInternal.MaxComponentLength; // Windows API definitions internal const int MAX_PATH = 260; // From WinDef.h @@ -159,6 +158,12 @@ namespace System.IO { // "\\server\share"). public static String GetDirectoryName(String path) { + return GetDirectoryNameInternal(path); + } + + [System.Security.SecuritySafeCritical] + private static string GetDirectoryNameInternal(string path) + { if (path != null) { CheckInvalidPathChars(path); diff --git a/src/mscorlib/src/System/IO/PathHelper.cs b/src/mscorlib/src/System/IO/PathHelper.cs index 0a57f6a..8e39b3c 100644 --- a/src/mscorlib/src/System/IO/PathHelper.cs +++ b/src/mscorlib/src/System/IO/PathHelper.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. + +#if FEATURE_PATHCOMPAT using System; using System.Collections; using System.Text; @@ -443,3 +445,4 @@ namespace System.IO { } } +#endif // FEATURE_PATHCOMPAT \ No newline at end of file diff --git a/src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs b/src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs index e43c49c..a28f54f 100644 --- a/src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs +++ b/src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs @@ -993,7 +993,7 @@ namespace System.Security.Permissions { /// IMPORTANT: This method should only be used after calling GetFullPath on the path to verify /// [System.Security.SecuritySafeCritical] - internal static void QuickDemand(FileIOPermissionAccess access, string fullPath, bool checkForDuplicates, bool needFullPath) + internal static void QuickDemand(FileIOPermissionAccess access, string fullPath, bool checkForDuplicates = false, bool needFullPath = false) { #if FEATURE_CAS_POLICY if (!CodeAccessSecurityEngine.QuickCheckForAllDemands()) -- 2.7.4