Get Workspace Path in Terminal
Is there an easy way to get the path to the current workspace (i.e. the directory containing src
, build
, devel
) with a bash command?
I could somehow extract it from $ROS_PACKAGE_PATH
but I am wondering if there is an easier way.
Asked by Felix Widmaier on 2018-04-12 05:45:12 UTC
Comments
$CMAKE_PREFIX_PATH
typically contains the paths to the workspaces. Entries havedevel
orinstall
suffixed though (it points to specific spaces, not the top-level workspace).roscd
(without any arg) cds into the top-level space sourced.Not sure there is a command / tool for this.
Asked by gvdhoorn on 2018-04-12 05:52:03 UTC
@gvdhoorn Thanks,
$CMAKE_PREFIX_PATH
looks good. It still needs some processing to extract the path but at least it more deterministic than$ROS_PACKAGE_PATH
.Asked by Felix Widmaier on 2018-04-12 09:51:56 UTC
Another way I have done this, albeit somewhat inelegant, is to use $(find aaa) to get an absolute path off a package and then tree down to it. $(find my_package)/../../my_file_in_workspace.
Asked by James NT on 2019-06-19 00:07:44 UTC