Skip to content

Commit 32b556c

Browse files
committed
Merge branch '3.0.3-develop' into issue-437
2 parents 0340b39 + 19f21d4 commit 32b556c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/com/magento/idea/magento2plugin/util/magento/GetModuleNameByDirectoryUtil.java

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import org.jetbrains.annotations.Nullable;
1818

1919
public final class GetModuleNameByDirectoryUtil {
20+
public static final int THEME_SPLIT_COUNT = 1;
21+
public static final String THEME_DIRECTORY_REGEX = "app\\/design\\/(adminhtml|frontend)\\/";
2022

2123
private GetModuleNameByDirectoryUtil() {}
2224

@@ -31,6 +33,13 @@ public static String execute(
3133
final PsiDirectory psiDirectory,
3234
final Project project
3335
) {
36+
// Check if directory is theme directory and return module name from directory path if yes
37+
final String[] splits = psiDirectory.getVirtualFile().getPath()
38+
.split(THEME_DIRECTORY_REGEX);
39+
if (splits.length > THEME_SPLIT_COUNT) {
40+
return splits[1].split("\\/")[2];
41+
}
42+
3443
final PhpFile registrationPhp = getRegistrationPhpRecursively(
3544
psiDirectory,
3645
project

0 commit comments

Comments
 (0)