Skip to content

Commit

Permalink
Fix the DevTools files-PIP
Browse files Browse the repository at this point in the history
Fixes #6216
  • Loading branch information
dtdesign committed Feb 6, 2025
1 parent bfc95bb commit 5446c34
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,10 @@ public function getInstructions(DevtoolsProject $project, $target)
}
} else {
$path = 'wcfsetup/install/files/';
$absolutePath = FileUtil::getRealPath($project->path . $path);

$directory = new \RecursiveDirectoryIterator($project->path . $path);
$filter = new \RecursiveCallbackFilterIterator($directory, static function ($current) {
$directory = new \RecursiveDirectoryIterator($absolutePath);
$filter = new \RecursiveCallbackFilterIterator($directory, static function ($current) use ($absolutePath) {
/** @var \SplFileInfo $current */
$filename = $current->getFilename();
if ($filename[0] === '.' && $filename !== '.gitignore' && $filename !== '.htaccess') {
Expand All @@ -322,8 +323,17 @@ public function getInstructions(DevtoolsProject $project, $target)
// ignore require build configuration file
return false;
} elseif ($filename === 'templates') {
// ignores both `templates` and `acp/templates`
return false;
$currentPath = FileUtil::addTrailingSlash($current->getPath());

// Ignore the template directory at the root of the core.
if (\str_ends_with($currentPath, $absolutePath)) {
return false;
}

// Also exclude the ACP template directory.
if (\str_ends_with($currentPath, FileUtil::addTrailingSlash($absolutePath . 'acp'))) {
return false;
}
}

return true;
Expand Down

0 comments on commit 5446c34

Please sign in to comment.