Class PathUtil
Provides utility methods for working with file paths, particularly to check if a file is within a specified directory.
public static class PathUtil
- Inheritance
-
PathUtil
- Inherited Members
Methods
IsInAnyDirectory(ICollection<string>, string)
Checks if a given file path is within any of the specified directories.
public static bool IsInAnyDirectory(ICollection<string> directoryPaths, string filePath)
Parameters
directoryPaths
ICollection<string>A collection of directory paths to check against.
filePath
stringThe path of the file to check.
Returns
- bool
True if the file is within any of the directories, otherwise false.
IsInDirectory(string, string)
Checks if a given file path is within a specified directory.
public static bool IsInDirectory(string directoryPath, string filePath)
Parameters
directoryPath
stringThe path of the directory to check against.
filePath
stringThe path of the file to check.
Returns
- bool
True if the file is within the directory, otherwise false.