Function isPackagePath
Check if a file is in the current path
bool isPackagePath(
string fullPath,
string packagePath
);
Example
Check project paths
"../../something.d" .isPackagePath("/Users/trial/") .should .equal(false);
"/Users/trial/trial_.d" .isPackagePath("/Users/trial/") .should .equal(false);
"/Users/trial/runner.d" .isPackagePath("/Users/trial/") .should .equal(true);
"/Users/trial/.trial/runner.d" .isPackagePath("/Users/trial/") .should .equal(false);
"C:\\Users\\trial\\runner.d" .isPackagePath("C:/Users/trial/") .should .equal(true);
Example
isPackagePath returns true for a project file when the project is inside a submodules folder
"/work/app/submodules/trial/source/trial/runner.d"
.isPackagePath("/work/app/submodules/trial/")
.should .equal(true);
Example
isPackagePath returns false for a vendored submodule file inside a project that is inside a submodules folder
"/work/app/submodules/trial/submodules/dep/source/dep.d"
.isPackagePath("/work/app/submodules/trial/")
.should .equal(false);