Reputation: 114
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 !
Upvotes: 3
Views: 1078
Reputation: 20699
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
Upvotes: 2
Reputation: 18507
To get your desktop path in Groovy you can use your Java code directly, since it works perfectly:
String userHomeFolder = System.getProperty("user.home") + "/Desktop";
If you want an alternative a Groovy way to do so could be:
String userHomeFolder = System.properties['user.home'] + "/Desktop"
Or:
String userHomeFolder = System.properties.'user.home' + "/Desktop"
All of this gets the same result.
Upvotes: 4