A good file path builder library for C#?
- by Igor Brejc
System.IO.Path in .NET is notoriously clumsy to work with. In my various projects I keep encountering the same usage scenarios which require repetitive, verbose and thus error-prone code snippets that use Path.Combine, Path.GetFileName, Path.GetDirectoryName, String.Format, etc. Scenarios like:
changing the extension for a given file name
changing the directory path for a given file name
building a file path using string formatting (like "Package{0}.zip")
building a path without resorting to using hard-coded directory delimiters like \ (since they don't work on Linux on Mono)
etc etc
Before starting to write my own PathBuilder class or something similar: is there a good (and proven) open-source implementation of such a thing in C#?