From dc18d06bcbf02d84ed48cfa250582c0bb7aa6a02 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Mon, 2 Jan 2023 02:02:34 -0800 Subject: [PATCH] fix: copying symlinks --- lua/oil/fs.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/oil/fs.lua b/lua/oil/fs.lua index 7f86cc2..8e325c3 100644 --- a/lua/oil/fs.lua +++ b/lua/oil/fs.lua @@ -178,6 +178,15 @@ end ---@param dest_path string ---@param cb fun(err: nil|string) M.recursive_copy = function(entry_type, src_path, dest_path, cb) + if entry_type == "link" then + vim.loop.fs_readlink(src_path, function(link_err, link) + if link_err then + return cb(link_err) + end + vim.loop.fs_symlink(link, dest_path, nil, cb) + end) + return + end if entry_type ~= "directory" then vim.loop.fs_copyfile(src_path, dest_path, { excl = true }, cb) return