Skip to content

Commit d79272a

Browse files
committed
Cache reversed names
1 parent a693773 commit d79272a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,13 @@ public static bool IsValidDirectoryName(string name)
391391
}
392392
return true;
393393
}
394+
395+
private static readonly string[] ReservedNames = new[] { "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9" };
396+
394397
private static bool IsReservedName(string name)
395398
{
396-
string[] reservedNames = new[] { "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9" };
397-
string nameWithoutExtension = Path.GetFileNameWithoutExtension(name).ToUpperInvariant();
398-
if (reservedNames.Contains(nameWithoutExtension))
399+
var nameWithoutExtension = Path.GetFileNameWithoutExtension(name).ToUpperInvariant();
400+
if (ReservedNames.Contains(nameWithoutExtension))
399401
{
400402
return true;
401403
}

0 commit comments

Comments
 (0)