hpc: use `takeDirectory` instead of `dropWhileEnd (/= '/')`