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 Windows-Path Bug #99

Merged
merged 2 commits into from
Feb 8, 2023
Merged

Fix Windows-Path Bug #99

merged 2 commits into from
Feb 8, 2023

Conversation

fl3pp
Copy link
Contributor

@fl3pp fl3pp commented Feb 3, 2023

Unfortunately, vim.fn.globpath cannot handle directory paths with trailing backslashes (even though it returns them with one). Example:

--[[ Structure
    c:\temp\reprod
    | dir1
    |  | snippets
    |  |  | lua.snippets
    | dir2
    |  | snippets
    |  |  | lua.snippets --]]

snip_dirs = vim.fn.globpath('c:\\temp\\reprod\\dir1,c:\\temp\\reprod\\dir2', 'snippets/', 0, 1)
-- { "c:\\temp\\reprod\\dir1\\snippets\\", "c:\\temp\\reprod\\dir2\\snippets\\" }

dirs = table.concat(dirs, ',')
-- "c:\\temp\\reprod\\dir1\\snippets\\,c:\\temp\\reprod\\dir2\\snippets\\"

snip_files = vim.fn.globpath("c:\\temp\\reprod\\dir1\\snippets\\,c:\\temp\\reprod\\dir2\\snippets\\","*.snippets",0,1)
-- BUG: { }

snip_files = vim.fn.globpath("c:\\temp\\reprod\\dir1\\snippets,c:\\temp\\reprod\\dir2\\snippets","*.snippets",0,1)
-- works: { "c:\\temp\\reprod\\dir1\\snippets\\lua.snippets", "c:\\temp\\reprod\\dir2\\snippets\\lua.snippets" }

@dcampos
Copy link
Owner

dcampos commented Feb 8, 2023

Thanks for your contribution!

@dcampos dcampos closed this Feb 8, 2023
@dcampos dcampos reopened this Feb 8, 2023
@dcampos dcampos merged commit 2a275d6 into dcampos:master Feb 8, 2023
@fl3pp
Copy link
Contributor Author

fl3pp commented Feb 8, 2023

Thanks for the fast merge!

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.

2 participants