mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0027054: Upgrade procedure corrupts files with DOS line endings
Treatment of files in DOS encoding corrected to avoid duplication of CR symbols
This commit is contained in:
parent
d573adcf38
commit
155408bf59
@ -1160,24 +1160,16 @@ proc ReadFileToList {theFilePath theFileContent theFileEOL} {
|
||||
set aFileContent [read $aFile]
|
||||
close $aFile
|
||||
|
||||
set aFileEOL "\r"
|
||||
if [regexp "\r\n" $aFileContent] {
|
||||
# detect DOS end-of-lines
|
||||
if { [regexp "\r\n" $aFileContent] } {
|
||||
set aFileEOL "\r\n"
|
||||
} elseif [regexp "\n" $aFileContent] {
|
||||
set aList [split [regsub -all "\r\n" $aFileContent "\n"] "\r\n"]
|
||||
} else {
|
||||
# standard UNIX end-of-lines
|
||||
set aFileEOL "\n"
|
||||
set aList [split $aFileContent "\n"]
|
||||
}
|
||||
|
||||
# convert to unix eol
|
||||
if {"$aFileEOL" != "\n"} {
|
||||
regsub -all {$aFileEOL} $aFileContent "\n" aFileContent
|
||||
}
|
||||
|
||||
set aList [split $aFileContent "\n"]
|
||||
# set aList {}
|
||||
# foreach aLine [split $aFileContent "\n"] {
|
||||
# lappend aList [string trimright $aLine]
|
||||
# }
|
||||
|
||||
return $aList
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user