function drush_is_nested_directory

8.0.x filesystem.inc drush_is_nested_directory($base_dir, $test_is_nested)
master filesystem.inc drush_is_nested_directory($base_dir, $test_is_nested)

Return 'TRUE' if one directory is located anywhere inside the other.

Related topics

1 call to drush_is_nested_directory()
drush_preflight_command_dispatch in includes/preflight.inc
Handle any command preprocessing that may need to be done, including potentially redispatching the command immediately (e.g. for remote commands).

File

includes/filesystem.inc, line 735
Filesystem utilities.

Code

function drush_is_nested_directory($base_dir, $test_is_nested) {
  // Ensure there is always exactly one '/' at the end of $base_dir
  $base_dir = rtrim($base_dir, '/') . '/';
  return substr($test_is_nested, 0, strlen($base_dir)) == $base_dir;
}