add std/appdirs (#20618)

This commit is contained in:
ringabout 2022-10-22 19:42:46 +08:00 • committed by GitHub
commit 9361938ccd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 87 additions and 1 deletions

View file

@ -1,4 +1,4 @@
import std/[paths, files, dirs]
import std/[paths, files, dirs, appdirs]
from stdtest/specialpaths import buildDir
import std/[syncio, assertions]
@ -21,3 +21,16 @@ block fileOperations:
let fh = open(string(dname/file), fmReadWrite) # createFile
fh.close()
doAssert fileExists(Path(dname/file))
block: # getCacheDir
doAssert getCacheDir().dirExists
block: # moveFile
let tempDir = getTempDir() / Path("D20221022T151608")
createDir(tempDir)
defer: removeDir(tempDir)
block: # moveDir
let tempDir = getTempDir() / Path("D20220609T161443")
createDir(tempDir)
defer: removeDir(tempDir)