88import com .intellij .openapi .vfs .LocalFileSystem ;
99import com .intellij .openapi .application .ReadAction ;
1010import com .intellij .openapi .project .DumbService ;
11+ import com .intellij .openapi .util .io .FileUtil ;
1112import com .intellij .openapi .project .Project ;
1213import com .intellij .openapi .vfs .VirtualFile ;
1314import com .intellij .psi .PsiDirectory ;
@@ -187,13 +188,12 @@ private void collectEditableFilesystemModuleNames(
187188 return null ;
188189 }
189190
190- for (final VirtualFile packagesRoot : getEditablePackagesRoots ()) {
191- final VirtualFile vendorDirectory = packagesRoot .findChild (nameParts [0 ]);
192- if (vendorDirectory == null || !vendorDirectory .isDirectory ()) {
193- continue ;
194- }
195-
196- final VirtualFile moduleDirectory = vendorDirectory .findChild (nameParts [1 ]);
191+ final LocalFileSystem fileSystem = LocalFileSystem .getInstance ();
192+ for (final String rootPath : getMagentoRootCandidates ()) {
193+ final String modulePath = FileUtil .toSystemIndependentName (
194+ Paths .get (rootPath , Package .packagesRoot , nameParts [0 ], nameParts [1 ]).normalize ().toString ()
195+ );
196+ final VirtualFile moduleDirectory = fileSystem .refreshAndFindFileByPath (modulePath );
197197 if (moduleDirectory == null || !moduleDirectory .isDirectory ()) {
198198 continue ;
199199 }
@@ -213,7 +213,9 @@ private Collection<VirtualFile> getEditablePackagesRoots() {
213213
214214 for (final String rootPath : getMagentoRootCandidates ()) {
215215 final VirtualFile packagesRoot = fileSystem .refreshAndFindFileByPath (
216- Paths .get (rootPath , Package .packagesRoot ).normalize ().toString ()
216+ FileUtil .toSystemIndependentName (
217+ Paths .get (rootPath , Package .packagesRoot ).normalize ().toString ()
218+ )
217219 );
218220 if (packagesRoot != null && packagesRoot .isDirectory ()) {
219221 packagesRoots .add (packagesRoot );
@@ -230,15 +232,19 @@ private Collection<String> getMagentoRootCandidates() {
230232 return candidates ;
231233 }
232234
233- candidates .add (configuredRoot );
235+ candidates .add (FileUtil . toSystemIndependentName ( configuredRoot ) );
234236
235237 final String basePath = project .getBasePath ();
236238 if (basePath != null ) {
237239 final String rootWithoutLeadingSlash = configuredRoot .startsWith ("/" )
238240 ? configuredRoot .substring (1 )
239241 : configuredRoot ;
240- candidates .add (Paths .get (basePath , rootWithoutLeadingSlash ).normalize ().toString ());
241- candidates .add (Paths .get (basePath , configuredRoot ).normalize ().toString ());
242+ candidates .add (FileUtil .toSystemIndependentName (
243+ Paths .get (basePath , rootWithoutLeadingSlash ).normalize ().toString ()
244+ ));
245+ candidates .add (FileUtil .toSystemIndependentName (
246+ Paths .get (basePath , configuredRoot ).normalize ().toString ()
247+ ));
242248 }
243249
244250 return candidates ;
0 commit comments