Hamza Amami Hamza Amami - 1 year ago 98
Groovy Question

Get desktop path with groovy

I'm automating a SoapUI project with Groovy that generate and excel report at the end with the results of my requests.

My problem is that I want to get the desktop path in which the file will be saved.

Something similar to this java code, but in Groovy :

String userHomeFolder = System.getProperty("user.home") + "/Desktop";

Thanks in advance !

Answer Source

Groovier way:

String userHomeFolder = "${System.properties.'user.home'}/Desktop"

you might also want to use a propper File.separator, but even with a mix of / and \ is should work fine

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download