From 89c98223ebf6bfeee5ef587ab748995e09dd4310 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 18 Aug 2021 23:55:43 -0400 Subject: remove path-too-long exception handling The path length limit no longer applies in .NET 5. --- src/SMAPI.Toolkit/Utilities/PathUtilities.cs | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/SMAPI.Toolkit') diff --git a/src/SMAPI.Toolkit/Utilities/PathUtilities.cs b/src/SMAPI.Toolkit/Utilities/PathUtilities.cs index 1d378042..2e9e5eac 100644 --- a/src/SMAPI.Toolkit/Utilities/PathUtilities.cs +++ b/src/SMAPI.Toolkit/Utilities/PathUtilities.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Diagnostics.Contracts; using System.IO; using System.Linq; @@ -150,32 +149,5 @@ namespace StardewModdingAPI.Toolkit.Utilities { return !Regex.IsMatch(str, "[^a-z0-9_.-]", RegexOptions.IgnoreCase); } - - /// Get the paths which exceed the OS length limit. - /// The root path to search. - internal static IEnumerable GetTooLongPaths(string rootPath) - { - if (!Directory.Exists(rootPath)) - return new string[0]; - - return Directory - .EnumerateFileSystemEntries(rootPath, "*.*", SearchOption.AllDirectories) - .Where(PathUtilities.IsPathTooLong); - } - - /// Get whether a file or directory path exceeds the OS path length limit. - /// The path to test. - internal static bool IsPathTooLong(string path) - { - try - { - _ = Path.GetFullPath(path); - return false; - } - catch (PathTooLongException) - { - return true; - } - } } } -- cgit