How are relative paths resolved?

When building some file system objects that use relative paths (within some unit tests), it looks like the folder used as the reference folder for these relative paths is always the folder where the active build.gradle is located, and not the PWD where the actual gradle command is executed. Is there some way to specify this reference folder?

Try ‘gradle.startParameter.projectDir’ or ‘System.getProperty(“user.dir”)’.

Thanks, Peter.

Looks like “user.dir” is what I need.

I modified the test configuration to set this system property:

test {
    useJUnit()
    reports.html.enabled = false
    allJvmArgs = ["-Xms384m", "-Xmx2500m", "-XX:MaxPermSize=128m", "-Djava.library.path=$moduleDir", "-d64"]
    systemProperty 'user.dir', moduleDir
}

Then set it when I fire gradle.

gradle -PmoduleDir=/data/bps_build/projects/mscore clean test

BTW, I don’t set user.dir directly because I use the moduleDir elsewhere…