wbthomason / packer.nvim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config
MIT License
7.72k stars 263 forks source link

installation from full URL fails on windows #1267

Open adigitoleo opened 4 months ago

adigitoleo commented 4 months ago

Steps to reproduce

Attempt to install a package from a full URL (e.g. https://git.sr.ht/~adigitoleo/overview.nvim).

local fn = vim.fn

local function bootstrap()
    local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
    if fn.empty(fn.glob(install_path)) > 0 then
        fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
        vim.o.runtimepath = vim.fn.stdpath('data') .. '/site/pack/*/start/*,' .. vim.o.runtimepath
        vim.cmd [[packadd packer.nvim]]
        return true
    end
    return false
end
local packer_bootstrap = bootstrap()

require("packer").startup(function(use)
    -- use "adigitoleo/overview.nvim"  -- THIS WORKS (github mirror)
    use "https://git.sr.ht/~adigitoleo/overview.nvim"  -- THIS DOESN'T
    if packer_bootstrap then
        require("packer").sync()
    end
end)

Actual behaviour

Pakcer fails to create the "leading directories" under AppData\Local because it attempts to use the full URL as the directory name.

Expected behaviour

Installation succeeds.

Notes

Using the full URL works fine on Linux, so I'm guessing this is related to how the directory creation command is constructed on Windows only.