Skip to content

Commit

Permalink
Add workaround for symlinking on Windows (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
wbthomason committed Dec 2, 2021
1 parent ff566d9 commit 851c62c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lua/packer/plugin_types/local.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,21 @@ local function cfg(_config)
config = _config
end

local symlink = a.wrap(vim.loop.fs_symlink)
-- Due to #679, we know that fs_symlink requires admin privileges on Windows. This is a workaround,
-- as suggested by @nonsleepr.

local symlink_fn
if util.is_windows then
symlink_fn = function(path, new_path, flags, callback)
flags = flags or {}
flags.junction = true
return vim.loop.fs_symlink(path, new_path, flags, callback)
end
else
symlink_fn = vim.loop.fs_symlink
end

local symlink = a.wrap(symlink_fn)

local function setup_local(plugin)
local from = plugin.path
Expand Down

0 comments on commit 851c62c

Please sign in to comment.