Properly escape folder names, add support for custom build directory