A good file path builder library for C#?

Posted by Igor Brejc on Stack Overflow See other posts from Stack Overflow or by Igor Brejc
Published on 2010-03-25T08:26:59Z Indexed on 2010/03/25 8:33 UTC
Read the original article Hit count: 476

Filed under:
|
|
|
|

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#?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET