Haskell语言Directory模块中函数setCurrentDirectory的用法及代码示例。
用法类型:
FilePath -> IO ()
setCurrentDirectorydir将调用进程的当前目录更改为dir
示例1:
源码:
import Directory
main = aaa "/tmp/FOO"
aaa ddd = do createDirectory ddd
setCurrentDirectory ddd
d <- getCurrentDirectory
print d
writeFile "aaa" "HELLO"
l <- getDirectoryContents d
print l
输出:
"/tmp/FOO"
输出:
[".","..","aaa"]
注:本文由纯净天空筛选整理自 haskell setCurrentDirectory。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。