AddShortcut will now detect and remove invalid characters from shortcut names and folders.

This commit is contained in:
Homes32
2023-01-30 19:55:14 -06:00
parent 8cfbfc29df
commit a83e112b1d

View File

@@ -1037,6 +1037,16 @@ GetParam,9,%WindowState%
GetParam,10,%Hotkey% GetParam,10,%Hotkey%
GetParam,11,%Tooltip% GetParam,11,%Tooltip%
// Space delimited list of illegal file name characters
Set,%IllegalFileNameChars%,"\ / : * ? #$q < > |"
// Strip illegal chars from Title
ForEach,%Char%,%IllegalFileNameChars%,Delim=#$s,StrFormat,Replace,%Title%,%Char%,"",%Title%
// Space delimited list of illegal directory name characters (\ is allowed here as we use it to signify a subdir)
Set,%IllegalDirNameChars%,"/ : * ? #$q < > |"
// Strip illegal chars from Folder
ForEach,%Char%,%IllegalDirNameChars%,Delim=#$s,StrFormat,Replace,%Folder%,%Char%,"",%Folder%
If,%_PhoenixAPI_ConfigMode%,Equal,PECMD,Begin If,%_PhoenixAPI_ConfigMode%,Equal,PECMD,Begin
If,%Folder%,Equal,".",Set,%Folder%,"" If,%Folder%,Equal,".",Set,%Folder%,""
@@ -1072,7 +1082,6 @@ If,%_PhoenixAPI_ConfigMode%,Equal,PECMD,Begin
// Final LINK command // Final LINK command
TXTReplace,"%TargetSystem32%\pecmd.ini","_END Shortcuts","%Cmd%#$x#$x_END Shortcuts" TXTReplace,"%TargetSystem32%\pecmd.ini","_END Shortcuts","%Cmd%#$x#$x_END Shortcuts"
End End
Else,Begin Else,Begin
// Shortcuts.exe // Shortcuts.exe