Bloody hell, *finally* got certificate authorities installing properly in Windows for https://codeberg.org/small-tech/auto-encrypt-localhost
The hardest bit? Windows paths with spaces in them + a likely a bug in PowerShell’s command parser when nesting single and double quotes.
Long story short:
safeDirectoryPathForWindows (directoryPath) {
return execSync(`Powershell (New-Object -ComObject Scripting.FileSystemObject).GetFolder('${directoryPath}').ShortPath`).toString().replace('\r\n', '')
}
FML.