42
42
--- @return string[]
43
43
local function get_top_trash_dirs (path )
44
44
local dirs = {}
45
- local dev = (uv .fs_stat (path ) or {}).dev
45
+ local dev = (uv .fs_lstat (path ) or {}).dev
46
46
local top_trash_dirs = vim .fs .find (" .Trash" , { upward = true , path = path , limit = math.huge })
47
47
for _ , top_trash_dir in ipairs (top_trash_dirs ) do
48
- local stat = uv .fs_stat (top_trash_dir )
48
+ local stat = uv .fs_lstat (top_trash_dir )
49
49
if stat and not dev then
50
50
dev = stat .dev
51
51
end
@@ -62,7 +62,7 @@ local function get_top_trash_dirs(path)
62
62
{ upward = true , path = path , limit = math.huge }
63
63
)
64
64
for _ , top_trash_dir in ipairs (top_trash_dirs ) do
65
- local stat = uv .fs_stat (top_trash_dir )
65
+ local stat = uv .fs_lstat (top_trash_dir )
66
66
if stat and stat .dev == dev then
67
67
ensure_trash_dir (top_trash_dir )
68
68
table.insert (dirs , top_trash_dir )
75
75
--- @param path string
76
76
--- @return string
77
77
local function get_write_trash_dir (path )
78
- local dev = uv .fs_stat (path ).dev
78
+ local dev = uv .fs_lstat (path ).dev
79
79
local home_trash = get_home_trash_dir ()
80
- if uv .fs_stat (home_trash ).dev == dev then
80
+ if uv .fs_lstat (home_trash ).dev == dev then
81
81
return home_trash
82
82
end
83
83
@@ -88,7 +88,7 @@ local function get_write_trash_dir(path)
88
88
89
89
local parent = vim .fn .fnamemodify (path , " :h" )
90
90
local next_parent = vim .fn .fnamemodify (parent , " :h" )
91
- while parent ~= next_parent and uv .fs_stat (next_parent ).dev == dev do
91
+ while parent ~= next_parent and uv .fs_lstat (next_parent ).dev == dev do
92
92
parent = next_parent
93
93
next_parent = vim .fn .fnamemodify (parent , " :h" )
94
94
end
@@ -200,7 +200,7 @@ local function read_trash_info(info_file, cb)
200
200
201
201
local basename = vim .fn .fnamemodify (info_file , " :t:r" )
202
202
trash_info .trash_file = fs .join (trash_base , " files" , basename )
203
- uv .fs_stat (trash_info .trash_file , function (trash_stat_err , trash_stat )
203
+ uv .fs_lstat (trash_info .trash_file , function (trash_stat_err , trash_stat )
204
204
if trash_stat_err then
205
205
cb (" .trashinfo file points to non-existant file" )
206
206
else
@@ -526,7 +526,7 @@ local function create_trash_info(path, cb)
526
526
local name = string.format (" %s-%d.%d" , basename , now , math.random (100000 , 999999 ))
527
527
local dest_path = fs .join (trash_dir , " files" , name )
528
528
local dest_info = fs .join (trash_dir , " info" , name .. " .trashinfo" )
529
- uv .fs_stat (path , function (err , stat )
529
+ uv .fs_lstat (path , function (err , stat )
530
530
if err then
531
531
return cb (err )
532
532
end
0 commit comments