summary refs log tree commit diff stats
path: root/lib/std/staticos.nim
diff options
context:
space:
mode:
authorTomohiro <gpuppur@gmail.com>2023-08-18 23:47:47 +0900
committerGitHub <noreply@github.com>2023-08-18 16:47:47 +0200
commiteb83d20d0d1ab1d0cbd9574a3dc1bcdae949e865 (patch)
tree000f603d9578f51a51861acf747d2639e0012db0 /lib/std/staticos.nim
parent7fababd583ee5e3c113c0d83a04c07f2ee0ef06d (diff)
downloadNim-eb83d20d0d1ab1d0cbd9574a3dc1bcdae949e865.tar.gz
Add staticFileExists and staticDirExists (#22278)
Diffstat (limited to 'lib/std/staticos.nim')
-rw-r--r--lib/std/staticos.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/std/staticos.nim b/lib/std/staticos.nim
new file mode 100644
index 000000000..2617c6913
--- /dev/null
+++ b/lib/std/staticos.nim
@@ -0,0 +1,13 @@
+## This module implements path handling like os module but works at only compile-time.
+## This module works even when cross compiling to OS that is not supported by os module.
+
+proc staticFileExists*(filename: string): bool {.compileTime.} =
+  ## Returns true if `filename` exists and is a regular file or symlink.
+  ##
+  ## Directories, device files, named pipes and sockets return false.
+  discard
+
+proc staticDirExists*(dir: string): bool {.compileTime.} =
+  ## Returns true if the directory `dir` exists. If `dir` is a file, false
+  ## is returned. Follows symlinks.
+  discard