Skip to content
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

Linux: genwxbind fails on override files with Windows CR/LF line ends #55

Closed
LesNewell-SheetCam opened this issue Jan 22, 2020 · 4 comments
Assignees

Comments

@LesNewell-SheetCam
Copy link

In Linux, If an override file uses Windows CR/LF line endings genwxbind fails with a lot of errors:
ERROR: Expected %end. File: ./override.hpp

@pkulchenko pkulchenko self-assigned this Jan 22, 2020
@pkulchenko
Copy link
Owner

What git settings do you have for core.autocrlf and core.eol? I'll check the file encoding and correct it, but you should be able to run genwxbind if you set core.eol to lf for this repository.

@LesNewell-SheetCam
Copy link
Author

This is for my own override file, not a wxLua one. It shouldn't have been crlf so it took me quite a while to figure out what was going on.

@pkulchenko
Copy link
Owner

@sheetcam, can you try the following patch:

diff --git a/wxLua/bindings/genwxbind.lua b/wxLua/bindings/genwxbind.lua
index 639df5d..ccc641a 100644
--- a/wxLua/bindings/genwxbind.lua
+++ b/wxLua/bindings/genwxbind.lua
@@ -1461,6 +1461,7 @@ function ReadOverrideFile(override_file)
     end

     for line in io.lines(filename) do
+        line = line:gsub("%s+$","") -- drop all trailing whitespaces not handled by io.lines
         local lineData = SplitString(line, delimiters)
         local isOverride = false
         local isEnd = false
@@ -1545,6 +1546,7 @@ function ReadInterfaceFile(filename)
     local linenumber = 0

     for line in io.lines(filename) do
+        line = line:gsub("%s+$","") -- drop all trailing whitespaces not handled by io.lines
         linenumber = linenumber + 1

         local lineTable =

@LesNewell-SheetCam
Copy link
Author

Yup, that appears to fix the problem. Thanks.

pkulchenko added a commit that referenced this issue Jan 22, 2020
This fixes handling of CRLF on Linux (which affected %end processing).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants