Referencing the user's home directory in a Gradle script

android, gradle, windows

Solution

more generic (read: "groovy" & not using "ant")

def homePath = System.properties['user.home']

Problem

Is there a cleaner way to reference a file in the user's home directory than doing the following in a gradle script? (referencing an Android keystore in this example) ``` homeDir = System.getenv('HOMEDRIVE') + System.getenv('HOMEPATH'); ... signingConfigs { release { storeFile file(homeDir + "\\.android\\releaseKeystore.jks") } } ... ```

Original source