cg_build_path adds needless "/" character in cases when the input path
ends/starts with character "/" itself. This character is added now only
in cases it is wanted and it was not set.
Changelog
- incorporate Jan's feedback - fix typo in patch description, use snprintf instead of sprintf
- deal with the situation if directory name is empty as well
- move the path concatenation functionality to a separate function