-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
iTerm color schemes once more are failing to parse colors #352
Comments
What colortool version are you running? ( |
I built it from master to see if the bug still where present, and that it was. Before running my locally built version it was version:
|
Can confirm that I also see this problem across all |
Did some experimentation. Seems that if I change my regional formatting to US from Swedish it successfully parses the file I put in a gist above. So to repro this issue, have Windows 10 running with US English as language and change the regional formatting to Swedish. |
My system language is also US English. |
Okay, knowing that setting the regional formatting to swedish will make this repro will help make this possible to actually investigate. I figured #1/#2 would have fixed this, but I'd need to walk through it in a debugger to find out what's broken this time. I've filed msft:20266491 to make sure I get to this at some point, but unfortunately it's pretty low on my backlog at the time. If someone wants to help debug why this is broken, a PR would be much appreciated 😊 |
I think the regional formatting thing is a bit of red herring. The problem is that the program supports multiple file formats, and it achieves this by attempting to open the file in each of the supported formats until one of them succeeds. This relies on the parsers failing silently when given the wrong file type as input, but that's not the case for the Ini parser, and thus you get this spurious error message. What is needed is some extra validation at the start of the Ini parser which will let it fail silently when given a file of the wrong type. Or possibly it could suppress its error messages until it has managed to parse at least one line successfully. Note that you can also bypass the error by omitting the file extension when loading the scheme. For example calling it like this:
That's because each parser tries to add their default file extension when matching the file name. So the Xml parser can find the file using the default This only works when you refer to the scheme via a relative path, though. And of course it's not really a satisfactory solution to the problem. I just thought it worth mentioning as a temporary workaround. |
In case it's of any help, below is a trivial patch that simply suppresses the Ini error message if it hasn't managed to read at least one string successfully. I don't know if that's the best solution to the problem, but it's at least an easy fix.
|
@j4james Based on your diagnosis, wouldn't it be easier/better to prevent the silent fail (and suppression) in the first place by checking the file format and encoding before opening and matching it against the parser? Doing it this way would also prevent the scenario of opening a misformatted file, etc. |
@cooperpellaton Possibly better, but it's hard to imagine anything easier than the five character change above. :) How exactly does one go about checking whether something is a valid ini file? The simplest solution I could think of was to call
|
Not sure if I am supposed to request to get this re-opened or if I should create another bug. But this is the same as in #2
Your Windows build number: (Type
ver
at a Windows Command Prompt)Microsoft Windows [Version 10.0.17763.253]
What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots)
Running:
PS C:\Tools\ColorTool> .\ColorTool.exe C:\Tools\ColorTool/schemes/molokai.itermcolors
Error loading ini file "C:\Tools\ColorTool/schemes/molokai.itermcolors"
for key "DARK_BLACK"
the value "" is invalid
The actual file contents can be found in this gist:
https://gist.github.com/SneWs/4bbb50dce9a132a4dcbd07e3e2c85c44
The colors should be successfully parsed and set without any error messages being rendered.
The text was updated successfully, but these errors were encountered: