let rec mkdir_p dir = if sys_file_exists dir then () else (mkdir_p (Filename.dirname dir); mkdir dir)