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 ^
4f1b89c30 ^
a6f90d4cd ^






5641be51c ^
0d5bd7e8b ^
66db9de71 ^
5641be51c ^
a6f90d4cd ^
7ea318a05 ^
a6f90d4cd ^
a6f90d4cd ^
ea3e18bc6 ^
a6f90d4cd ^




66db9de71 ^
a6f90d4cd ^
ca1f3f36b ^
8494338bc ^
0e7338d65 ^
a6f90d4cd ^

82c009a2c ^
a6f90d4cd ^
a6f90d4cd ^
a6f90d4cd ^
97743faa8 ^
e2d38a57e ^



49fa421ba ^

39049e151 ^
a6f90d4cd ^



39049e151 ^
a6f90d4cd ^

6e9a98d1e ^
a6f90d4cd ^
d9cf9b079 ^
d2b45dbe8 ^
39290cf88 ^
15dd3a225 ^
a64d4dc35 ^
8cccaebc2 ^
a64d4dc35 ^
5641be51c ^
c3344862b ^





451129de4 ^

c3344862b ^
6e9a98d1e ^
2781fea9e ^
c3344862b ^
5641be51c ^
02a2180a6 ^
c3344862b ^
bcda71a8a ^


39049e151 ^
56aa1ac5b ^
a6f90d4cd ^

caf787800 ^

a6f90d4cd ^


a6f90d4cd ^

e84834db7 ^


bc37668c5 ^
1854d2978 ^
56aa1ac5b ^
9c17a32e0 ^
5641be51c ^
a6f90d4cd ^
860cbd310 ^
6c1c8f51b ^
3ac6bd8ae ^
c94647aec ^
3ac6bd8ae ^






8241e5502 ^

ba38b83dd ^




87a2ced1b ^
b1ad5fd7d ^
ba38b83dd ^
ca4b971bc ^
fd31e8ff6 ^
f04d21f27 ^
1284827df ^
d83736221 ^
ba38b83dd ^
5ad1acc60 ^










b97a7dbf3 ^
a6f90d4cd ^
c94647aec ^
4b0ba5e3f ^
86556ebfd ^

a6f90d4cd ^
4b0ba5e3f ^
860cbd310 ^
66db9de71 ^



860cbd310 ^
7ea318a05 ^

8241e5502 ^
92c2a51bf ^
860cbd310 ^
fd31e8ff6 ^
a6f90d4cd ^
a64f03230 ^
ca4b971bc ^
39290cf88 ^
a6f90d4cd ^

a6f90d4cd ^
39049e151 ^
92b8fac94 ^
39049e151 ^
f08e90f0d ^
42ae2064d ^
ba38b83dd ^
848676cec ^
538b06a12 ^
050789a8f ^


92c2a51bf ^



39049e151 ^
20d56875d ^
7e747d11c ^
20d56875d ^
39049e151 ^
20d56875d ^

a6f90d4cd ^
ca1f3f36b ^




5641be51c ^
a6f90d4cd ^


394a56650 ^

ca1f3f36b ^
a6f90d4cd ^
739b4f214 ^
56aa1ac5b ^
a6f90d4cd ^
1284827df ^
6c1c8f51b ^
ca4b971bc ^
ba38b83dd ^

87a2ced1b ^
82c009a2c ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211