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.
$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.
@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
.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.