Closed fritzmg closed 7 years ago
Example output of $file->getPathname()
for a vendor
package (e.g. the core-bundle
):
C:\xampp\htdocs\contao4\vendor\contao\core-bundle\src/Resources/contao/templates\analytics\analytics_google.html5
It could be fixed by changing src/DependencyInjection/Compiler/AddResourcesPathsPass.php#L45 from
$paths[] = sprintf('%s/system/modules/%s', $rootDir, $name);
to
$paths[] = sprintf('%ssystem/modules/%s', $rootDir . DIRECTORY_SEPARATOR, $name);
Not sure if this is the best way to go though.
I assume it also works if you replace DIRECTORY_SEPARATOR
with '/'
in line 249?
No, then it won't work for the vendor paths, because there the root path has a backslash at the end:
C:\xampp\htdocs\contao4\vendor\…
^
vs
C:\xampp\htdocs\contao4/system/…
^
These kind of issues should disappear in Contao 4.4, because we added a more robust StringUtil::stripRootDir()
in 8a74bb16f659e5c79b6c428c33360dc3f42264a6.
@ausi: looks good :)
Please close the ticket then, so you can re-open it in case the issue occurs in Contao 4.4 as well.
The assignment to the 4.3.11 milestone should probably be removed.
Yet another Windows path problem: when an extension under
system/modules
is present with atemplates
folder and you go to Templates » New template, the full path to those extension templates will be shown in the<optgroup>
label:Responsible code: src/Resources/contao/dca/tl_templates.php#L249
$file->getPathname()
will befor example, thus
will not have any effect, because it tries to remove
from the full path. Due to the failure of the
str_replace
, thepreg_replace
also won't have any effect.