Forum Discussion

singhtester's avatar
singhtester
Contributor
12 years ago

get file/folder path

Hi folks,

Can anyone suggest, how tp get the file/folder path from groovy.Not sure soapui board is the place to ask?

I have tried all, as below, but all reterives the SOAPUI path, till bin dir:

//log.info new File(".").absolutePath
//log.info new File("").getCanonicalPath()
//String currentDir = new File(".").getAbsolutePath()
//def scriptDir = getClass().protectionDomain.codeSource.location.path

I want to get the path of the file "file.groovy", which is "c:\user\folder1\subfolder1\sub2\sub3\sub4\" from the below:

c:\user\folder1\subfolder1\sub2\sub3\sub4\file.groovy

Any inputs helps

Thanks,

1 Reply

  • This serves my purpose:

    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def holder = groovyUtils. getProjectPath()