Skip to content

Support dynamic project root in file search script #2

@Yazanmy

Description

@Yazanmy

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

The current file search script works well for projects with a fixed docroot (e.g., docroot/modules/custom), but it doesn’t automatically detect the docroot configured in DDEV projects. In projects where web is used as the docroot, the script fails or requires manual changes.

Describe your solution

Read the docroot value from .ddev/config.yaml and use it dynamically in the script. This would:

  • Make the script project-agnostic
  • Avoid errors like unbound variable
  • Automatically include modules and themes from the correct root

Example:
local docroot=$(grep '^docroot:' .ddev/config.yaml | awk '{print $2}') || docroot="docroot" find "$docroot/modules/custom" "$docroot/themes/custom" \ -type f \ -regextype posix-extended \ -regex ".*\.($ext_pattern)$" \ -not -path "*/node_modules/*"

Describe alternatives

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions