[cs] Attempt to fix trailing slashes on mkdir paths. Relates to #2977