File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,7 +165,24 @@ local check_self = function(self)
165165 return self
166166end
167167
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
169186
170187-- TODO: Could use this to not have to call new... not sure
171188-- Path.__call = Path:new
@@ -242,10 +259,6 @@ function Path:new(...)
242259 filename = path_string ,
243260
244261 _sep = sep ,
245-
246- -- Cached values
247- _absolute = uv .fs_realpath (path_string ),
248- _cwd = uv .fs_realpath " ." ,
249262 }
250263
251264 setmetatable (obj , Path )
You can’t perform that action at this time.
0 commit comments