Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refer script paths relatively to the current script #13

Closed
isuru89 opened this issue Apr 20, 2017 · 0 comments
Closed

Refer script paths relatively to the current script #13

isuru89 opened this issue Apr 20, 2017 · 0 comments
Assignees
Milestone

Comments

@isuru89
Copy link
Contributor

isuru89 commented Apr 20, 2017

Currently if you want to refer another script (to import, or run) you need to specify full relative path from the script base directory. But sometime it is nice to be able to refer to the script path relative to the current script. Relative paths can be identified if path string starts with characters ./ or ../.

For eg: assuming there are two scripts in script base directory as below.

  • foo/bar/script.groovy
  • foo/bar/baz/query.groovy

When you are calling query.groovy from script.groovy you should do,

        RUN ("foo/bar/baz/query")

But with new enhancement, it can written as,

        RUN ("./baz/query")

In otherway, calling script.groovy from query.groovy would be,

        RUN ("../script")

CAUTION: Moving scripts into different directories within script base directory could cause relative path mismatches. In such cases, it is a user's responsibility of refactoring affected paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant