fix directory separator in i18nTextCollector on Windows (#10681)

* fix directory separator in i18nTextCollector for Windows

* fix typo
This commit is contained in:
Florian Thoma 2023-02-09 17:09:48 +11:00 committed by GitHub
parent 20e4aae25b
commit 54fc4ee9d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -457,7 +457,7 @@ class i18nTextCollector
$this->getWriter()->write( $this->getWriter()->write(
$entities, $entities,
$this->defaultLocale, $this->defaultLocale,
$this->baseSavePath . '/' . $module->getRelativePath() $this->baseSavePath . DIRECTORY_SEPARATOR . $module->getRelativePath()
); );
return $this; return $this;
} }
@ -511,25 +511,25 @@ class i18nTextCollector
$modulePath = $module->getPath(); $modulePath = $module->getPath();
// Search all .ss files in themes // Search all .ss files in themes
if (stripos($module->getRelativePath() ?? '', 'themes/') === 0) { if (stripos($module->getRelativePath() ?? '', 'themes' . DIRECTORY_SEPARATOR) === 0) {
return $this->getFilesRecursive($modulePath, null, 'ss'); return $this->getFilesRecursive($modulePath, null, 'ss');
} }
// If non-standard module structure, search all root files // If non-standard module structure, search all root files
if (!is_dir("{$modulePath}/code") && !is_dir("{$modulePath}/src")) { if (!is_dir($modulePath . DIRECTORY_SEPARATOR . 'code') && !is_dir($modulePath . DIRECTORY_SEPARATOR . 'src')) {
return $this->getFilesRecursive($modulePath); return $this->getFilesRecursive($modulePath);
} }
// Get code files // Get code files
if (is_dir("{$modulePath}/src")) { if (is_dir($modulePath . DIRECTORY_SEPARATOR . 'src')) {
$files = $this->getFilesRecursive("{$modulePath}/src", null, 'php'); $files = $this->getFilesRecursive($modulePath . DIRECTORY_SEPARATOR . 'src', null, 'php');
} else { } else {
$files = $this->getFilesRecursive("{$modulePath}/code", null, 'php'); $files = $this->getFilesRecursive($modulePath . DIRECTORY_SEPARATOR . 'code', null, 'php');
} }
// Search for templates in this module // Search for templates in this module
if (is_dir("{$modulePath}/templates")) { if (is_dir($modulePath . DIRECTORY_SEPARATOR . 'templates')) {
$templateFiles = $this->getFilesRecursive("{$modulePath}/templates", null, 'ss'); $templateFiles = $this->getFilesRecursive($modulePath . DIRECTORY_SEPARATOR . 'templates', null, 'ss');
} else { } else {
$templateFiles = $this->getFilesRecursive($modulePath, null, 'ss'); $templateFiles = $this->getFilesRecursive($modulePath, null, 'ss');
} }
@ -904,7 +904,7 @@ class i18nTextCollector
$fileList = []; $fileList = [];
} }
// Skip ignored folders // Skip ignored folders
if (is_file("{$folder}/_manifest_exclude") || preg_match($folderExclude ?? '', $folder ?? '')) { if (is_file($folder . DIRECTORY_SEPARATOR . '_manifest_exclude') || preg_match($folderExclude ?? '', $folder ?? '')) {
return $fileList; return $fileList;
} }