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

Add colorized failure message for Windows 10. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add colorized failure message for Windows 10. #8

wants to merge 1 commit into from

Conversation

rjframe
Copy link

@rjframe rjframe commented Dec 24, 2017

Both cmd.exe and powershell.exe support colorized text formatting on Windows 10; Anyone choosing to use the legacy cmd.exe would see the control character output rather than the colors, though.

I use the registry to check the Windows major version because the API functions (VerifyVersionInfo, etc.):

  1. require an app manifest for Windows 8.1 and 10, and
  2. are deprecated, presumably as part of the push to UWP.

@s-ludwig
Copy link
Member

Thanks, good to know that the same escape codes are now possible on Windows! Shouldn't GetVersionEx work to determine the version? It's available since Windows 2000 and still works for UWP apps.

@rjframe
Copy link
Author

rjframe commented Dec 26, 2017

Unless the application is manifested for Windows 8.1 or Windows 10[1], GetVersionEx will report as Windows 8 (and apparently is no longer recommended for >= 8.1[2]). I would bet most D developers don't manifest their applications (especially not the test executable), so this wouldn't work. The registry isn't a great method, but I'm not sure of a reliable way to do it otherwise, short of fixing dub to embed a manifest if present and generating a template manifest on dub init.

[1]: The manifest is an XML file included as a resource in the EXE.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa374191(v=vs.85).aspx

[2]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx?f=255&MSPPError=-2147217396 - "Instead, use the Version Helper functions"

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

Successfully merging this pull request may close these issues.

2 participants