function to split path into path and filename
mkdir function using llvm api instead of posix
clear global after use, TODO remove this global entirely