This is the simple function to avoid running colcon build in the directory which is not contain folder named 'src/'
(which might infer the place which is not the colcon workspace)
i know that removing build/ install/ logs/ is so painful !
| # Append this to your ".bashrc" | |
| function colcon_build() { | |
| if [ -d "src" ]; then | |
| command colcon build "$@" | |
| else | |
| echo "Error: 'src/' directory not found in the current directory." | |
| fi | |
| } | |
| alias colcon_build=colcon_build | |
| # And use colcon_build 4 life :) |