Slicer 4.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
/home/kitware/Dashboards/Nightly/Slicer4/Base/QTCore/qSlicerUtils.h

Return the path without the intermediate directory or return path if there is no expected "IntDir". subDirWithoutIntDir corresponds to N last compononent of the path excluding the "IntDir".

Path subDirWithoutIntDir Return IntDir
/path/to/lib/module/Foo lib/module /path/to/lib/module Foo
/path/to/lib/module/Release lib/module /path/to/lib/module Release
/path/to/lib/module/Release/ lib/module /path/to/lib/module Release
/path/to/lib/module/Release module /path/to/lib/module Release
/path/to/lib/module/Release (Empty string) /path/to/lib/module/Release (Empty string)
/path/to/lib/module/Release/foo.txt lib/module /path/to/lib/module/Release/foo.txt (Empty string)
/path/to/lib/module/Release/foo.txt lib/module/Release /path/to/lib/module/Release foo.txt
/path/to/lib/module/Release /path/to/lib/module /path/to/lib/module Release
/path/to/bin lib/module /path/to/bin (Empty string)
/path/to/Foo.app/Contents/MacOSX bin /path/to/Foo.app/Contents/MacOSX (Empty string)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines