-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File: Re-add support to skip CR (\r
) in File::get_as_text
#63733
File: Re-add support to skip CR (\r
) in File::get_as_text
#63733
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parse_utf8
changes seems fine.
ed25a6d
to
438db2a
Compare
438db2a
to
8b7f4b0
Compare
I still had a doubt about my |
Test files seem to be wrong, CRLF one it only has LF. |
06e509f
to
619e99e
Compare
Indeed, my Edit: I finally got it to work. With your advice I could fix the FileAccess test but the String one still fails.
|
dca94be
to
f13f181
Compare
Should an enumeration that selects the desired line ending be used instead? I understand this is a quick fix, but I'm concerned about adding a parameter that will need to be changed later on, resulting in a breaking change down the line. enum LineEnding {
LineEnding_Unix, // lf
LineEnding_Mac // cr
LineEnding_Windows // crlf
} |
Probably overkill, no modern platform uses CR only anymore. It was used on Mac OS prior to Mac OS X. |
f13f181
to
961e9ac
Compare
This was removed in godotengine#63481, and we confirmed that it's better like this, but we add back the possibility to strip CR as an option, to optionally restore the previous behavior. For performance this is done directly in `String::parse_utf8`. Also fixes Android `FileAccess::get_line()` as this one _should_ strip CR. Supersedes godotengine#63717.
961e9ac
to
1418f97
Compare
This was removed in #63481, and we confirmed that it's better like this,
but we add back the possibility to strip CR as an option, to optionally
restore the previous behavior.
For performance this is done directly in
String::parse_utf8
.Also fixes Android
FileAccess::get_line()
as this one should strip CR.Supersedes #63717.
Will backport for
3.x
with theget_as_text()
option defaulting to true to fix the compat breakage.@bruvzg My changes to
String::parse_utf8()
might be a huge hack, please review.Speed comparison on a big file with a debug build on Linux, as described in #63717 (comment):
File::get_as_text()
from before Address remaining scoped storage regressions #63481master
after Address remaining scoped storage regressions #63481\r
inget_as_text()
to keep standardized Unix format #63717 withreplace("\r", "")