Identification of flat versus hierarchical project structure - what is the best way?

In my plugin I have to convert Eclipse workspace macro into a location relevant to Idea project. Initial version of plugin was designed with hierarchical structure in mind and everything worked perfectly. Now, we moved to Gradle build, and it is not hierarchical, but flat.

For hierarchichal structure the mapping is easy, $workspace_dir > $ProjectFileDir$, for "flat" - not so much. The way I see now is to compare both parents, of project and module and if they match, then it is "flat" project structure, otherwise - "hierarchical". Is there any other way?

Hierarchical

project/
     project.ipr
     moduleA/
          module.iml
     moduleB/
          module.iml
          script.sh

Flat

project/
     project.ipr
moduleA/
     moduleA.iml
moduleB/
     moduleB.iml
     script.sh

1 comment

IntelliJ IDEA has no concept of two distinct project structures that you must choose between. You can put the project file and the .iml files in any location, which may or may not correspond to the location of the source code. Because of that, there is no good way to identify what you're looking for, and you'll have to rely on heuristics that you'll need to create yourself.

0

Please sign in to leave a comment.