fixes #21977; add sideEffects to dirExists, fileExists and symlinkExists (#21978)

This commit is contained in:
ringabout
2023-06-01 14:03:17 +08:00
committed by GitHub
parent 8f760080c5
commit b3e1892eb7
4 changed files with 6 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ from std/private/osdirs import dirExists, createDir, existsOrCreateDir, removeDi
export PathComponent
proc dirExists*(dir: Path): bool {.inline, tags: [ReadDirEffect].} =
proc dirExists*(dir: Path): bool {.inline, tags: [ReadDirEffect], sideEffect.} =
## Returns true if the directory `dir` exists. If `dir` is a file, false
## is returned. Follows symlinks.
result = dirExists(dir.string)

View File

@@ -9,7 +9,7 @@ from std/private/osfiles import fileExists, removeFile,
moveFile
proc fileExists*(filename: Path): bool {.inline, tags: [ReadDirEffect].} =
proc fileExists*(filename: Path): bool {.inline, tags: [ReadDirEffect], sideEffect.} =
## Returns true if `filename` exists and is a regular file or symlink.
##
## Directories, device files, named pipes and sockets return false.

View File

@@ -119,7 +119,7 @@ when not defined(windows):
const maxSymlinkLen* = 1024
proc fileExists*(filename: string): bool {.rtl, extern: "nos$1",
tags: [ReadDirEffect], noNimJs.} =
tags: [ReadDirEffect], noNimJs, sideEffect.} =
## Returns true if `filename` exists and is a regular file or symlink.
##
## Directories, device files, named pipes and sockets return false.
@@ -137,7 +137,7 @@ proc fileExists*(filename: string): bool {.rtl, extern: "nos$1",
proc dirExists*(dir: string): bool {.rtl, extern: "nos$1", tags: [ReadDirEffect],
noNimJs.} =
noNimJs, sideEffect.} =
## Returns true if the directory `dir` exists. If `dir` is a file, false
## is returned. Follows symlinks.
##
@@ -155,7 +155,7 @@ proc dirExists*(dir: string): bool {.rtl, extern: "nos$1", tags: [ReadDirEffect]
proc symlinkExists*(link: string): bool {.rtl, extern: "nos$1",
tags: [ReadDirEffect],
noWeirdTarget.} =
noWeirdTarget, sideEffect.} =
## Returns true if the symlink `link` exists. Will return true
## regardless of whether the link points to a directory or file.
##

View File

@@ -6,7 +6,7 @@ from paths import Path, ReadDirEffect
from std/private/ossymlinks import symlinkExists, createSymlink, expandSymlink
proc symlinkExists*(link: Path): bool {.inline, tags: [ReadDirEffect].} =
proc symlinkExists*(link: Path): bool {.inline, tags: [ReadDirEffect], sideEffect.} =
## Returns true if the symlink `link` exists. Will return true
## regardless of whether the link points to a directory or file.
result = symlinkExists(link.string)