Skip to main content



      Home
Home » Newcomers » Newcomers » Create folders (non-existent) in a given path(Eclipse Plugin generate project structure)
Create folders (non-existent) in a given path [message #1842506] Mon, 21 June 2021 18:14 Go to next message
Eclipse UserFriend
In my project, in a generator class I'm trying to create package folders from a given string path e.g. "com/example/config". Is there way (method) I can do it quickly without splitting the string by "/" and recursively creating one folder in another?

This is what I've tried so far:
def static generateJavaPackages(String pkgName, IProject projectDir, IProgressMonitor monitor) {
		val mainJavaFolder = '/src/main/java/'

		/* create package folders */
		try {
			
			projectDir.getFolder(mainJavaFolder + pkgName).create(true, true, monitor)
			
		} catch (Exception exception) {

			exception.printStackTrace()
		}
	}
Re: Create folders (non-existent) in a given path [message #1842507 is a reply to message #1842506] Mon, 21 June 2021 20:32 Go to previous messageGo to next message
Eclipse UserFriend
This is a programming
question and perhaps more appropriate for somewhere like Stack Overflow.

EDIT: removed incorrect answer

[Updated on: Mon, 21 June 2021 23:46] by Moderator

Re: Create folders (non-existent) in a given path [message #1842510 is a reply to message #1842507] Mon, 21 June 2021 23:38 Go to previous messageGo to next message
Eclipse UserFriend
Thanks! I did post the question on Stack Overflow.
Re: Create folders (non-existent) in a given path [message #1842511 is a reply to message #1842510] Mon, 21 June 2021 23:49 Go to previous message
Eclipse UserFriend
I misread your question initially. You're on the right track, you will just need to recursively check the folder's
parent to see if it exists and create it if not.
Previous Topic:Eclipse Opens, shows splash screen, then immediately crashes
Next Topic:I am getting the same output while running the JSON programs on my macbook
Goto Forum:
  


Current Time: Wed Jul 02 23:33:08 EDT 2025

Powered by FUDForum. Page generated in 0.11418 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top