From b3e1892eb7f4cb8b2090be7ad12286cc54506e91 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Thu, 1 Jun 2023 14:03:17 +0800 Subject: fixes #21977; add sideEffects to dirExists, fileExists and symlinkExists (#21978) --- lib/std/dirs.nim | 2 +- lib/std/files.nim | 2 +- lib/std/private/oscommon.nim | 6 +++--- lib/std/symlinks.nim | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/std/dirs.nim b/lib/std/dirs.nim index df6107c51..0b0366d44 100644 --- a/lib/std/dirs.nim +++ b/lib/std/dirs.nim @@ -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) diff --git a/lib/std/files.nim b/lib/std/files.nim index b2161218b..b61b7dafd 100644 --- a/lib/std/files.nim +++ b/lib/std/files.nim @@ -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. diff --git a/lib/std/private/oscommon.nim b/lib/std/private/oscommon.nim index b747e33f1..c24db3f67 100644 --- a/lib/std/private/oscommon.nim +++ b/lib/std/private/oscommon.nim @@ -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. ## diff --git a/lib/std/symlinks.nim b/lib/std/symlinks.nim index 54ab7b677..60487740c 100644 --- a/lib/std/symlinks.nim +++ b/lib/std/symlinks.nim @@ -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) -- cgit 1.4.1-2-gfad0 raq <rumpf_a@web.de> 2014-08-28 09:38:14 +0200 Nimrod renamed to Nim' href='/ahoang/Nim/commit/compiler/cgendata.nim?h=devel&id=2781fea9e2a67e86f37277f5e2808fc444a1173a'>2781fea9e ^