How do I set an excluded folder that is not created yet for a Module ?

I'm unable to use this way, Because I'll get null for VirtualFile

val moduleRootManager = ModuleRootManager.getInstance(module)
val modifiableRootModel = moduleRootManager.modifiableModel
val excludeFolder = localFileSystem.refreshAndFindFileByIoFile(File("/Users/abhay/Documents/projectFolder/target"))

Because the target folder would be created only when classes are built. 

Please sign in to leave a comment.