Picking up idea variables programmatically
Hi,
I'm writing some tests and I'd like to be able to programmatically pick up the project root directory from my code.
I know there are idea specific variables such as "MODULE_DIR", but is there any way I can get the project root from my code?
Many thanks
Richard
Please sign in to leave a comment.
The only way would be to set the "working directory" text field in the run/debug configuration to the desired directory (or one that is relative to the desired directory) and then use the "user.dir" standard Java System property to access it. Or, of course, just set the property yourself as a VM option.
Thanks
Yeah I went with the user.dir approach. I wasn't too keen on the custom -D arg in case someone forgot to set it
Many thanks
Richard