Tidy up the cleaning of the dependencies directory.

The dependencies directory cleaning was not removing dependencies/gui. Also it was dependent on building the dependencies so this has been refactored away.