haampie / libtree

ldd as a tree
MIT License
2.67k stars 60 forks source link

Support another root directory #37

Closed tianyuanhao closed 2 years ago

tianyuanhao commented 3 years ago

Add a new option to set the root directory, because a cross-compilation environment usually uses a different root directory than the native one.

Fix #29

haampie commented 3 years ago

Another thing is that relative rpaths should not go beyond the system root.

Edit: basically don't join the root and file paths and always keep both absolute. Whenever you have to open a file, use root / file.relative_path(). Also when printing, we can simply drop the root, and maybe just print it on top (except when it's /).