The function convert an absolute path to a relative path in respect to a reference. The longest common parent directory is taken as reference. Symbolic links are converted to original paths before performing the operation.
abs2rel(path, ref_path, mustWork = NA)
path | The path to be converted (if it is not absolute, the current working directory is considered as its parent, and a warning is shown). |
---|---|
ref_path | The reference path to be compared to
|
mustWork | (optional) logical: if TRUE an error is given
if |
The relative path
License: GPL 3.0
L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. DOI: 10.1016/j.cageo.2020.104473, URL: http://sen2r.ranghetti.info/.
#> [1] "/home/lranghetti/share/git/github/ranghetti/sen2r/inst"#> [1] "/home/lranghetti/R/x86_64-pc-linux-gnu-library/3.6/gdalUtils"#> [1] "/home/lranghetti/share/git/github/ranghetti/sen2r/R/abs2rel.R"#> [1] "/usr/lib/R/library/base"#> [1] "/home/lranghetti/share/git/github/ranghetti/r2sen/inst"abs2rel(in_path_1, ref_path)#> [1] "../../../../../../R/x86_64-pc-linux-gnu-library/3.6/gdalUtils"abs2rel(in_path_2, ref_path)#> [1] "../R/abs2rel.R"#> [1] "/usr/lib/R/library/base"#> [1] "../../r2sen/inst"#> [1] "."