Skip to content

osversion: Add Parse function and make partially cross-platform#2019

Closed
vvoland wants to merge 2 commits intomicrosoft:mainfrom
vvoland:osversion-parse
Closed

osversion: Add Parse function and make partially cross-platform#2019
vvoland wants to merge 2 commits intomicrosoft:mainfrom
vvoland:osversion-parse

Conversation

@vvoland
Copy link

@vvoland vvoland commented Feb 6, 2024

address: #2018

osversion: Add Parse function

Add function that parses the string representation back to the OSVersion struct.

osversion: Make OSVersion cross-platform

Move non-Windows dependent code outside of the windows build tagged files. This makes it possible to use the version parse/stringifying code on non-Windows platforms and keep the code that interacts with Windows API only for the Windows builds.

return osv
}

// Parse parses a string representation of OSVersion.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we could add an example input value to outline the expected format (if there's a reference link somewhere, I guess that could be useful, but not strictly necessary).

@vvoland vvoland force-pushed the osversion-parse branch 2 times, most recently from c8b6a9f to 95bc44c Compare February 6, 2024 14:14
Move non-Windows dependent code outside of the `windows` build tagged
files. This makes it possible to use the version parse/stringifying code
on non-Windows platforms and keep the code that interacts with Windows
API only for the Windows builds.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Add function that parses the string representation back to the OSVersion
struct.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@kiashok
Copy link
Contributor

kiashok commented Feb 6, 2024

address: #2018

osversion: Add Parse function

Add function that parses the string representation back to the OSVersion struct.

osversion: Make OSVersion cross-platform

Move non-Windows dependent code outside of the windows build tagged files. This makes it possible to use the version parse/stringifying code on non-Windows platforms and keep the code that interacts with Windows API only for the Windows builds.

Added a comment to the github issue #2018 so all the discussion is in one place for future reference as well :)

@ambarve
Copy link
Contributor

ambarve commented Apr 2, 2024

Closing this based on the discussion at #2018. Can discuss this further on the github issue if required.

@ambarve ambarve closed this Apr 2, 2024
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.

4 participants