|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
script filename and absolute pathname
And the absolute pathname of the script? thanks Francesco
|
|
|
Re: script filename and absolute pathname> What is the way to obtain the name of the file containing the grovy script
> being executed ? It should be possible, but maybe not easy. If you compile sample.groovy with groovyc, and then do javap sample the output clearly shows the script name it was compiled from: javap sample Compiled from "sample.groovy" public class sample extends groovy.lang.Script{ ... I don't know how to get this info at runtime however. It's there somewhere, you just need to find it! -- Hamlet D'Arcy hamletdrc@... On Sat, Oct 24, 2009 at 3:18 PM, Francesco Pasqualini <frapas@...> wrote: > > What is the way to obtain the name of the file containing the grovy script > being executed ? > And the absolute pathname of the script? > thanks > Francesco --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email --
Hamlet D'Arcy |
|
|
Re: script filename and absolute pathnameWe can get the script filename getting the first args of the groovy executable ... Is there a way to get it ? prompt# groovy script.groovy
On Sun, Oct 25, 2009 at 5:01 PM, Hamlet D'Arcy <hamletdrc@...> wrote:
|
|
|
Re: script filename and absolute pathnameI looked at source (GroovyShell, GroovyMain) and it seems that is not possible to obtain the filename of the running groovy script.
I need to port some scripts from perl to groovy and in perl the special variable $0 contain the script filename
If we can get the script filename we can make groovy scripts that take library from path relative to the script and so we can make self container folders (with scripts and libraries) that we can ports across machines)
for example /home/frank/groovy/test.groovy take library in the relative path /home/frank/groovy/lib -- Francesco On Sat, Oct 24, 2009 at 9:18 PM, Francesco Pasqualini <frapas@...> wrote:
|
|
|
Re: Re: script filename and absolute pathnameI did something like this on the top of my scripts to determine the name of the script: def scriptFile = getClass().protectionDomain.codeSource.location.path def scriptDir = new File(scriptFile).parent HTH, Ingo On Tuesday, October 27, 2009, at 10:56PM, "Francesco Pasqualini" <frapas@...> wrote: > I looked at source (GroovyShell, GroovyMain) and it seems that is not possible to obtain the filename of the running groovy script.
I need to port some scripts from perl to groovy and in perl the special variable $0 contain the script filename
If we can get the script filename we can make groovy scripts that take library from path relative to the script and so we can make self container folders (with scripts and libraries) that we can ports across machines)
for example
/home/frank/groovy/test.groovy
take library in the relative path
/home/frank/groovy/lib
--
Francesco
On Sat, Oct 24, 2009 at 9:18 PM, Francesco Pasqualini <frapas@...> wrote:
|
|
|
Re: Re: script filename and absolute pathnameWow what a cleaver hack !
thanks
On Wed, Oct 28, 2009 at 10:20 AM, IngoNoSpam <zatterzatter@...> wrote:
|
| Free embeddable forum powered by Nabble | Forum Help |