Hamza Amami Hamza Amami - 7 months ago 40
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 !


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