所以,我觉得这个函数可以删除.可能受影响的就是tidy在含有中文的脚本路径不能自动折叠行.
原始函数如下
请看 $nScriptFileName = StringRegExpReplace($nScriptFileName, "[\x{0080}-\x{FFFF}]", "u")
Func _CheckAllSourceFileNames(ByRef $ScriptFileName)
; Get Include Paths
Local $User_IncludeDirs = StringSplit(RegRead("HKCU\Software\AutoIt v3\Autoit", "Include"), ";")
ReDim $IncludeDirs[2 + UBound($User_IncludeDirs) - 1]
; First store the AutoIt3 directory to the search table
$IncludeDirs[0] = _PathFull($CurrentAutoIt_InstallDir) & "\include"
$IncludeDirs_cnt = 1
; Add User Include Directories to the table
For $x = 1 To $User_IncludeDirs[0]
If StringStripWS($User_IncludeDirs[$x], 3) <> "" And FileExists($User_IncludeDirs[$x]) Then
$IncludeDirs[$IncludeDirs_cnt] = StringReplace($User_IncludeDirs[$x], '"', '')
$IncludeDirs_cnt += 1
EndIf
Next
; Add the scriptpath as last entry to the table
Local $szDrive, $szDir, $szFName, $szExt
_PathSplit($ScriptFileName, $szDrive, $szDir, $szFName, $szExt)
$IncludeDirs[$IncludeDirs_cnt] = _PathFull($szDrive & $szDir)
;
; Add \ at the end of the Include dirs in the search table
For $x = 0 To $IncludeDirs_cnt
If StringRight($IncludeDirs[$x], 1) <> "\" Then
$IncludeDirs[$x] &= "\"
EndIf
Next
;
; Process scriptfile
;
; use [1] for original script info
; use [2] for au3check script info
$SourceFileNames[1][0] = $ScriptFileName
$SourceFileNames[1][1] = ""
$SourceFileNames[1][2] = ""
; change the newsourcename to pure ASCII characters
Local $nScriptFileName = BinaryToString(StringToBinary($ScriptFileName, 1), 1)
; Replace any none standard ASCII character by a "u" to avoid issues
$nScriptFileName = StringRegExpReplace($nScriptFileName, "[\x{0080}-\x{FFFF}]", "u")
Local $tScriptFileName, $tScriptFileNameExt, $dummy
Local $UTFIncludeNameFound = 0
If $nScriptFileName <> $ScriptFileName Then
_PathSplit($nScriptFileName, $dummy, $dummy, $tScriptFileName, $tScriptFileNameExt)
$nScriptFileName = @TempDir & "\AutoIt3WrapperRunTmpFiles\" & $tScriptFileName & $tScriptFileNameExt
$rc = FileCopy($ScriptFileName, $nScriptFileName, 1 + 8)
$SourceFileNames[1][2] = $nScriptFileName
$ScriptFileName = $nScriptFileName
EndIf
; Get all #include lines from Main script into Array and process them
Local $TSourceCode = FileRead($ScriptFileName)
$TSourceCode = StringRegExpReplace($TSourceCode & @CRLF, "(?s)(?i)(\s*#cs\s*.-\#ce\s*)(\r\n)", "\2")
$TSourceCode = StringRegExpReplace($TSourceCode, "(?s)(?i)" & '("")|(".*?")|' & "('')|('.*?')|" & "(\s*;.*?)(\r\n)", "\1\2\3\4\6")
Local $inclArray = StringRegExp($TSourceCode, "(?m)(?s)(?i)^\s*(#include\s*[<'""]\s*\S*\s*[>'""]).*?$", 3)
For $x = 0 To UBound($inclArray) - 1
$UTFIncludeNameFound += Add_Include($inclArray[$x], @ScriptDir)
Next
; Copy Main script to Temp dir when in contains #include filenames with UTF characters in the filename
If $SourceFileNames[1][2] = "" Then
If $UTFIncludeNameFound Then
_PathSplit($nScriptFileName, $dummy, $dummy, $tScriptFileName, $tScriptFileNameExt)
$nScriptFileName = @TempDir & "\AutoIt3WrapperRunTmpFiles\" & $tScriptFileName & $tScriptFileNameExt
$rc = FileCopy($ScriptFileName, $nScriptFileName, 1 + 8)
$SourceFileNames[1][2] = $nScriptFileName
$ScriptFileName = $nScriptFileName
EndIf
EndIf
; Replace the tempfilename in the #include statements of all tempfiles
For $x = 1 To UBound($SourceFileNames) - 1
If $SourceFileNames[1][2] = "" Then ContinueLoop
If $x = 2 Then ContinueLoop
$TSourceCode = FileRead($SourceFileNames[$x][2])
For $y = 2 To UBound($SourceFileNames) - 1
If $y = 2 Then ContinueLoop ; skip au3check table record
If $x = $y Then ContinueLoop ; skip own #include record
If $SourceFileNames[$y][2] <> "" Then
$TSourceCode = StringReplace($TSourceCode, $SourceFileNames[$y][1], '"' & $SourceFileNames[$y][2] & '"')
EndIf
Next
FileMove($SourceFileNames[$x][2], StringReplace($SourceFileNames[$x][2], ".au3", "_old.au3"), 1)
FileWrite($SourceFileNames[$x][2], $TSourceCode)
If $x = 1 Then ConsoleWrite('->Main script copied to temp file because of unicode characters in one of the filenames: ' & $nScriptFileName & @CRLF)
Next
EndFunc ;==>_CheckAllSourceFileNames
|