[cs,java] fix embedding resources in subdirectories

also, move recursive mkdir from gencpp to common