Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Preprocess modules_dir to ensure successful module loading on Windows #50

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

WindyValley
Copy link

Probably for consistency with vim.fn.stdpath, core.helper.path_join uses '' as the path separator on Windows. However, even on Windows, the path returned by vim.fs.find still uses /. This caused pack:load_modules_packages to error when extracting the module name from the module path. To avoid compatibility issues with other places where core.helper.path_join is used, only preprocess modules_path with vim.fs.normalize in pack:load_modules_packages.

…Windows

Probably for consistency with `vim.fn.stdpath`, `core.helper.path_join` uses '\' as the path separator on Windows. However, even on Windows, the path returned by `vim.fs.find` still uses `/`. This caused `pack:load_modules_packages` to error when extracting the module name from the module path. To avoid compatibility issues with other places where `core.helper.path_join` is used, only preprocess modules_path with `vim.fs.normalize` in `pack:load_modules_packages`.
@WindyValley
Copy link
Author

WindyValley commented Sep 7, 2023

另外,有两个地方看符号名似乎用反了

function helper.data_path()
local cli = require('core.cli')
if cli.config_path then
return cli.config_path
end
return vim.fn.stdpath('data')
end

dope/lua/core/helper.lua

Lines 16 to 22 in d7ed25a

function helper.config_path()
local cli = require('core.cli')
if cli.data_path then
return cli.data_path
end
return vim.fn.stdpath('config')
end

我没用dope脚本,不太确定会有什么后果

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant