Replace use of ASCII control characters with unicode characters allowed in Windows filenames (fixes shearing with a Windows server)

This commit is contained in:
2024-07-10 15:23:13 -04:00
parent 0ebc404db2
commit 82b1e31e5b
2 changed files with 11 additions and 16 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ function cliMUTNEntryCompleter {
$mutnPath = (Resolve-Path '~\AppData\Local\libmutton\entries').Path
try {
$trimmedPaths = If (Test-Path $mutnPath) {
(Get-ChildItem -Path $mutnPath -Recurse -File).FullName.Substring($mutnPath.Length) -replace '\\', '/' -replace ' ', [char]0x23bd
(Get-ChildItem -Path $mutnPath -Recurse -File).FullName.Substring($mutnPath.Length) -replace '\\', '/' -replace ' ', [char]0x259d
}
} catch {
$trimmedPaths = $null # if any errors occur (especially, "You cannot call a method on a null-valued expression", set $trimmedPaths to $null
@@ -50,6 +50,6 @@ function mutn {
[string]$option
)
#Invoke-Expression -Command ('/usr/local/bin/mutn ' + ($entry -replace ' ', '` ' -replace [char]0x1a, '` '), $argument, $option).Trim() # UNIX testing
Invoke-Expression -Command ('mutn.exe ' + ($entry -replace ' ', '` ' -replace [char]0x23bd, '` '), $argument, $option).Trim()
#Invoke-Expression -Command ('/usr/local/bin/mutn ' + ($entry -replace ' ', '` ' -replace [char]0x259d, '` '), $argument, $option).Trim() # UNIX testing
Invoke-Expression -Command ('mutn.exe ' + ($entry -replace ' ', '` ' -replace [char]0x259d, '` '), $argument, $option).Trim()
}