-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
feat(native): add Locale module #938
Conversation
src/Core/App.re
Outdated
@@ -255,6 +255,10 @@ let start = init => { | |||
|
|||
Revery_Native.initApp(); | |||
|
|||
AppLog.infof(m => | |||
m("Operating in locale : %s", Revery_Native.Locale.getUser()) |
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.
Good idea to add a log for this
src/Native/locale.c
Outdated
camlRet = caml_copy_string(ret); | ||
free(ret); |
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.
This doesn't look like it's hitting the Windows path - just linux.
I guess we should check:
- Does
ret
need to be freed for Apple? - Does
ret
need to be freed for Windows? I think the answer is yes - Does
ret
need to be freed for Linux?
If the answer is to all of those, we could free(ret)
after the #ifdef
/#endif
block. Otherwise, if we just need to free some of them - we'd need to include it in the platform condition
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.
Yeah that was my bad. I fixed it in eedb70b. On Linux and macOS we dont need to free (in fact we segfault if we do, predictably). I added a shouldFree
variable that I think makes it a bit clearer. Let me know if you think this is better!
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.
Looks good to me! Thanks @zbaylin
This is to get the current user (and maybe eventually system) locale information.