isSubPath static method

bool isSubPath(
  1. String fullPath,
  2. String basePath
)

Implementation

static bool isSubPath(String fullPath, String basePath) {
  if (basePath == '/') return true;

  final fullSegments = getPathSegments(fullPath);
  final baseSegments = getPathSegments(basePath);

  if (fullSegments.length < baseSegments.length) return false;

  for (var i = 0; i < baseSegments.length; i++) {
    if (fullSegments[i] != baseSegments[i]) return false;
  }

  return true;
}