Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IDEA: How do I see subdirectories in an empty project?

I wish to use IDEA to edit a directory full of files of no particular type. So, I create a new project of type Empty Project and point it at my directory.

The project view now shows the files in the directory itself. But, it doesn't show any subdirectories. This is very strange.

Even more strangely, I can still use New -> Directory to create a new directory. From the command line I can see that the directory has been created; but, from within IDEA, it's still not appearing.

What's going on here? And, more importantly, how can I actually get it to show me my subdirectories?

This is IntelliJ IDEA 12.1.1. I did find IntelliJ does not show project folders, which sounds similar. But, it is referring to a different version of IDEA and they're not using an Empty Project. So, I don't think it's relevant.

like image 240
David Given Avatar asked Apr 18 '13 20:04

David Given


1 Answers

In IntelliJ, you have to create at least one module. As CrazyCoder said in the comments, adding a module sets the root folder of what to display in the Project pane.

Here are steps that I took to show empty folders.

In a terminal window

mkdir one
mkdir one/two
mkdir one/two/three
mkdir one/two/three/four

In Intellij 15.0.2, I created a new project, selected Empty Project and set the Project Location to the one folder.

After creating the project, IntelliJ prompts me with a Project Structure dialog with Modules selected in the navigation tree. I clicked the '+' button in the middle pane to add a module. I chose Static Web as the module type to prevent creation of an additional src folder. I set the Content root and the Module file location of the module to the same one folder.

add module

I clicked Finish and then Ok. This gave me this structure

project structure

like image 198
Kirby Avatar answered Oct 16 '22 06:10

Kirby