col*_*ulb 2 ocaml mkdir sys
我想创建一个新目录(如果它尚不存在)。尝试了几件事,遗憾的是我没有在Sys图书馆找到任何东西。
Sys
我得到的最接近的解决方案是: if not (Sys.is_directory "vegetables") then Sys.mkdir "vegetabels"
if not (Sys.is_directory "vegetables") then Sys.mkdir "vegetabels"
这显然不起作用,因为抛出了异常。谢谢你!
oct*_*ron 7
你错过了Sys.file_exists(在类unix系统中目录被认为是文件):
Sys.file_exists
let create_newdir path perm = if not (Sys.file_exists path) then Sys.mkdir path perm
归档时间:
3 年,9 月 前
查看次数:
908 次
最近记录: