Try fixing issue where spaces in the working directory causes the build to fail
Use backticks for command substitution, and quote dirname's arguments