nim-lang - 如何创建目录?

标签 nim-lang

我想检查一个目录是否存在,如果不存在则创建它。 我怎样才能做到这一点?我尝试了 writeFile,因为我想在其中创建一个文件,但这似乎不起作用。

最佳答案

existsDir:http://nim-lang.org/docs/os.html#existsDir,string

创建目录:http://nim-lang.org/docs/os.html#createDir,string

所以这应该可行:

import os
let dir = "foo"
if not existsDir(dir):
  createDir(dir)

关于nim-lang - 如何创建目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32566272/

相关文章:

math - 你如何在 Nimrod 中使用矩阵?

nim-lang - 错误: expression has no address

nim-lang - 添加在 Nim 中使用制表的功能

types - "static type"和 "dynamic type"怎么可能不同?

nim-lang - 如何在 Nim 中将非纯函数标记为纯函数

nim-lang - 如何启用 --threads :on only for files using it?

nim-lang - 元组中的 Nim 存储过程引用

security - Jester 中的 CSRF 防伪 token

nim-lang - 是否有可能破坏 Nim 中的序列?