I would like to convert a relative path to an absolute path.
How is that done?
The absolutePath function works by beginning at the starting folder and moving up one level for each "../" in the relative path. Then it concatenates the changed starting folder with the relative path to produce the equivalent absolute path.
In simple words, an absolute path refers to the same location in a file system relative to the root directory, whereas a relative path points to a specific location in a file system relative to the current directory you are working on.
To write the absolute path, you have to use a slash “/” to start it, representing the root directory.
The location attribute on the property task will convert relative paths to absolute.
<property name="absolute.path" location="${relative.path}"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With