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 |
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, i.e. 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 (i.e. |
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. This flag has no effect on the Unix path format. 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 on Windows. Trailing dots do not pose any problems in Unix-based file systems and they don't pose potential trimming bugs so this flag has no effect when the Unix path format is used. |
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, i.e. 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 and NoTrailingDots 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. |