Skip to content

v2.0

Latest
Compare
Choose a tag to compare
@danyx23 danyx23 released this 09 Oct 19:56

Version 2.0

This is a major rewrite with breaking changes. The hope is that this will make the library safer to use, as well as more flexible for uncommon use cases.

There is now a new type, PathFragment, that can be iterated over to get all the directories in a path. E.g.:

var path = AbsoluteFilename.FromAbsolutePath(@"C:\dirA\dirB\test.txt");
foreach (var fragment in path.PathFragments)
    System.Console.WriteLine(fragment);
// Will print:
// C:\
// dirA
// dirB
// test.txt

Deprecated methods/properties

The Parent property has been removed on all 4 filename/directory classes.

New methods

IsBelow/IsAbove

4 methods have been added to query whether one directory/filename is below another directory:

AbsoluteFilename.IsBelow(AbsoluteDirectory dir)
AbsoluteDirectory.IsBelow(AbsoluteDirectory dir)
AbsoluteDirectory.IsAbove(AbsoluteDirectory dir)
AbsoluteDirectory.IsAbove(AbsoluteFilename filename)

PathFragments

All 4 filename/directory classes implement IPathFragmentProvider and implement the new property PathFragments to enumerate the parts that constitute the path (see the example above)

FromPathFragments

All 4 filename/directory classes have a new static method to create them from an enumeration of PathFragments, e.g.
AbsoluteDirectory.FromPathFragments(IEnumerable fragments)

Bugfixes

  • The typo in the static function Utility.IsEntirePathIsDescendingOnly has been fixed, the function name is now Utility.IsEntirePathDescendingOnly
  • Several obsolete Nuget references were left in the SmartPathsTests project. These have been removed.
  • The empty path could be combined with other paths. This is no longer possible and now tested against.