--> global function create_directory(string name, integer mode=0o700, bool make_parent=true) if not finit then initf() end if assert(length(name)!=0) name = get_proper_path(name) -- Remove any trailing slash. if name[$]=SLASH then name = name[1..$-1] end if if make_parent then integer pos = rfind(SLASH, name) if pos!=0 then string parent = name[1..pos-1] if file_exists(parent) then assert(file_type(parent)==FILETYPE_DIRECTORY) else if not create_directory(parent, mode, make_parent) then return 0 end if end if end if end if bool ret if platform()=LINUX then ret = not c_func(xCreateDirectory, {name, mode}) elsif platform()=WINDOWS then ret = c_func(xCreateDirectory, {name, 0}) end if return ret end function