Enum PathOptions
Provides options to control how path parsing is handled.
Namespace: Singulink.IO
Assembly: Singulink.IO.FileSystem.dll
Syntax
[Flags]
public enum PathOptions
Remarks
Most applications should not attempt to process unfriendly paths as the pitfalls and edge cases are numerous and difficult to predict. NoUnfriendlyNames is generally the recommended option to use. Applications like file managers that must work with all possible paths including those that are likely to be buggy/problematic should use None instead and take great care to ensure they are handled correctly. It is safe to use None for paths that are obtained by directly querying the file system (as opposed to user input or file data) and never stored for later use.
Fields
Name | Description |
---|---|
AllowEmptyDirectories | Allows paths with empty directories to be processed without throwing an exception by removing them from the path. If this flag is set then paths like |
NoControlCharacters | Disallows control characters in entry names. Control characters are characters with ASCII codes 1-31. This flag has no effect on the Windows path format (control characters are always disallowed in Windows paths). |
NoLeadingSpaces | Disallows entry names with a leading space. Leading spaces can cause problems for many Windows applications and are not fully supported by File Explorer. They can be difficult to handle correctly in application code, e.g. trimming input from users/data needs to be handled with care and System.IO often doesn't play nice with them on Windows. |
NoNavigation | Disallows navigational path segments (e.g. |
NoReservedDeviceNames | Disallows entry names that match reserved device names. This flag has no effect on the Unix path format. Reserved device names in paths can cause problems for many Windows applications and are not supported by File Explorer. Reserved device names include CON, PRN, AUX, NUL, COM1 to COM9 and LPT1 to LPT9. |
NoTrailingDots | Disallows entry names with a trailing dot. Trailing dots can cause problems for many Windows applications, are not supported by File Explorer, and System.IO often doesn't play nice with them. |
NoTrailingSpaces | Disallows entry names with a trailing space. Trailing spaces can cause problems for many Windows applications and are not supported by File Explorer. They can be difficult to handle correctly in application code, e.g. trimming input from users/data needs to be handled with care and System.IO often doesn't play nice with them on Windows. |
NoUnfriendlyNames | A combination of the NoReservedDeviceNames, NoLeadingSpaces, NoTrailingSpaces, NoTrailingDots and NoControlCharacters flags. This is the default value used for all parsing operations if no value is specified. |
None | Default value with no options set which allows all possible valid file system paths without wildcard characters. |
PathFormatDependent | Effectively causes the NoUnfriendlyNames flags to be appended when using the Windows and Universal path formats. Unix-based file systems tend to handle "unfriendly" paths much better than Windows-based file systems, so you can use this flag if you only want to disallow unfriendly paths on Windows and universal paths. |