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

[fuzzydir] fix unicode character on Windows #8

Merged
merged 1 commit into from
Mar 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions fuzzydir.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ end
-- Platform-dependent optimization

local powershell_version = call_command({
"powershell.exe",
"powershell",
"-NoProfile",
"-Command",
"$Host.Version.Major",
Expand All @@ -124,10 +124,16 @@ end
function fast_readdir(path)
if powershell_version >= 3 then
return call_command({
"powershell.exe",
"powershell",
"-NoProfile",
"-Command",
"& { Get-ChildItem -LiteralPath FileSystem::\"" .. path .. "\" -Directory | foreach { $_.Name } }",
[[
$dirs = Get-ChildItem -LiteralPath ]] .. string.format("%q", path) .. [[ -Directory
sibwaf marked this conversation as resolved.
Show resolved Hide resolved
foreach($dir in $dirs) {
$u8clip = [System.Text.Encoding]::UTF8.GetBytes($dir.Name)
[Console]::OpenStandardOutput().Write($u8clip, 0, $u8clip.Length)
Write-Host ""
} ]],
})
end

Expand Down