Skip to content

Rose::StringUtility::directoryDistance

Edit distance between two directory names.

Synopsis

Declared in <src/Rose/StringUtility/FileUtility.h>

[[visibility]]
int
directoryDistance(
    std::string const& left,
    std::string const& right);

Description

Essentially the edit distance without substituion in directory name tokens between two directories. Returns the "distance" between left and right. The distance is defined as the number of cd's that only move up or down one directory that it would take to move from the directory of the filename to the directory that was given by appPath. This is intended as a heuristic to gage whether or not one believes that the left is related to the right directory. Examples:

Between /a/b/c/file.h and /a/b/d/e/ the distance is 3 because one must cd ..; cd d; cd e

Return Value

Directory distance.

Parameters

Name

Description

left

Left directory path.

right

Right directory path.

Created with MrDocs