-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(windows): use junctions instead of symlinks (#509)
- Loading branch information
Showing
1 changed file
with
6 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ | |
-- Homepage: https://github.com/nvim-neorocks/rocks.nvim | ||
-- Maintainers: NTBBloodbath <[email protected]>, Vhyrro <[email protected]>, mrcjkb <[email protected]> | ||
|
||
-- NOTE: On Windows, we must create junctions, because NTFS symlinks require admin privileges. | ||
|
||
local adapter = {} | ||
|
||
local nio = require("nio") | ||
|
@@ -41,11 +43,11 @@ local function create_symlink_sync(symlink_location, symlink_dir_name, dest_dir_ | |
return true | ||
else | ||
log.debug(("Creating symlink directory: %s"):format(symlink_dir_name)) | ||
local success, err = vim.uv.fs_symlink(dest_dir_path, symlink_dir_path) | ||
local success, err = vim.uv.fs_symlink(dest_dir_path, symlink_dir_path, { junction = true }) | ||
if not success then | ||
log.error(("Error creating symlink directory: %s (%s)"):format(symlink_dir_name, err or "unknown error")) | ||
end | ||
return success | ||
return success or false | ||
end | ||
end | ||
|
||
|
@@ -57,7 +59,8 @@ local create_symlink_async = nio.create(function(symlink_location, symlink_dir_n | |
log.debug(("Symlink directory %s exists already."):format(symlink_dir_name)) | ||
else | ||
log.debug(("Creating symlink directory: %s"):format(symlink_dir_name)) | ||
local err, success = nio.uv.fs_symlink(dest_dir_path, symlink_dir_path) | ||
---@diagnostic disable-next-line: param-type-mismatch | ||
local err, success = nio.uv.fs_symlink(dest_dir_path, symlink_dir_path, { junction = true }) | ||
if not success then | ||
log.error(("Error creating symlink directory: %s (%s)"):format(symlink_dir_name, err or "unknown error")) | ||
end | ||
|