Hey community,
I'm a little bit drown in thoughts about the best/ fastest way to perform a lookup of the relation between two paths. My paths have an order (a number that determine the amount of sub-sequences/directories) and are already unified so there is no need take this into account. What I want to achieve is to determine if a given path is one of the following:
- The parents of the path tested; given A/B/C then is A the parent of B and C and A/B is the parent of C
- The same path as the path tested
- A totally different path as the path tested
I know there are some tricks in C# to speed string comparsion up, I'm currently using
public bool Contains(PathDescriptor subFolder)
{
return subFolder.GetAbsolutePath().StartsWith(GetAbsolutePath(), StringComparison.OrdinalIgnoreCase);
}
but I was wondering if there is a better/faster solution to perform the same task. Again, I need to know if the path tested is any child directory regardless of the hirachy. This is important because for our tool we decided to allow local overrides for our Processor Units. This means the deeper the tool walks into the project directory, the more priority get the Processor Units found there.
Thanks in advance