GithubHelp home page GithubHelp logo

ndepend / ndepend.path Goto Github PK

View Code? Open in Web Editor NEW
87.0 87.0 17.0 333 KB

A OO framework to handle all sorts of paths operations: File, Directory, Absolute, Drive Letter, UNC, Relative, prefixed with an Environment Variable, that contain Variable... This framework is used in the product NDepend to handle all paths operations.

Home Page: http://www.NDepend.com

License: MIT License

C# 100.00%

ndepend.path's People

Contributors

ndepend avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ndepend.path's Issues

Invalid validation IsChildOf

The method IsChildOf returns an invalid result in the following test-case:
parentDirectory = new String("D:/Foo").ToAbsoluteDirectoryPath();
m_PathString = new String("D:/Foo bar").ToAbsoluteDirectoryPath();

public bool IsChildOf(IDirectoryPath parentDirectory) {
            Debug.Assert(parentDirectory != null);
            string parentPathLowerCase = parentDirectory.ToString().ToLower();
            string thisPathLowerCase = m_PathString.ToLower();
            ...
            return thisPathLowerCase.IndexOf(parentPathLowerCase) == 0;
}

thisPathLowerCase.IndexOf(parentPathLowerCase) === 0 will result in true, but m_PathString is no child of parentDirectory.

Separate Interfaces and provide NuGet Packages

First: let me thank you for open sourcing this remarkable piece of software.
I have long criticized that the .net framework does not provide a simple mean to model file paths but defaults to strings instead. To Build upon this Lib I want to do the following two things:

  1. I want to separate the implementation from the interface and create two projects.
  2. I want to provide NuGet packages for both of them to facilitate reuse.

The separation of interfaces and implementation is a crucial point for reuse as I want to build an abstraction layer to encapsulate all system interaction (file system, envvars, time,...) that allows for easy mocking of said functionality and still use your Lib.
However your implementation directly uses file system and envvar functionality.
Once complete I would provide an implementation where the abstraction layer is extended to the implementation of NDepend.Path.

I am currently working on these features in my fork and wanted to get some feedback.

Please prepare this project for packaging

  1. remove binary files from this repository (because only sources should be here, and binaries should be distributed separately in source-based linux distributions)
    I mean /obj/Debug directory
  2. set version in AssemblyInfo.cs
  3. create a tag in github.com (this will create source tarball for distribution)

thanks

Feature Suggestions

I love this library, but here are a couple things I've run into that I think would make it better:

  • relative path interfaces should have a parameterless GetAbsolutePath() method that gets an absolute path relative to the working directory, which is a pretty common operation

  • FileInfo / DirectoryInfo properties can be cache the created instance on the first get call and return that for subsequent calls instead of making a new instance each time


Any interest in having these items added? I could assist with implementing them.

Unrelated aside: I would have much preferred if you could use this library without the string extensions, but rather with methods like: DirectoryPath.Create(string path), AbsoluteDirectoryPath.Create(string path) etc...or just using constructors. It feels like a bad code smell to pollute the string class with methods that only apply to paths and not to any other strings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.