File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,24 @@ local check_self = function(self)
165
165
return self
166
166
end
167
167
168
- Path .__index = Path
168
+ Path .__index = function (t , k )
169
+ local raw = rawget (Path , k )
170
+ if raw then
171
+ return raw
172
+ end
173
+
174
+ if k == " _cwd" then
175
+ local cwd = uv .fs_realpath " ."
176
+ t ._cwd = cwd
177
+ return cwd
178
+ end
179
+
180
+ if k == " _absolute" then
181
+ local absolute = uv .fs_realpath (t .filename )
182
+ t ._absolute = absolute
183
+ return absolute
184
+ end
185
+ end
169
186
170
187
-- TODO: Could use this to not have to call new... not sure
171
188
-- Path.__call = Path:new
@@ -242,10 +259,6 @@ function Path:new(...)
242
259
filename = path_string ,
243
260
244
261
_sep = sep ,
245
-
246
- -- Cached values
247
- _absolute = uv .fs_realpath (path_string ),
248
- _cwd = uv .fs_realpath " ." ,
249
262
}
250
263
251
264
setmetatable (obj , Path )
You can’t perform that action at this time.
0 commit comments