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

fix default login on windows #294

Merged
merged 1 commit into from
Oct 9, 2014
Merged

Conversation

gfgtdf
Copy link
Contributor

@gfgtdf gfgtdf commented Oct 9, 2014

getenv("USER") doesn't work on windows. Also winapifunctions use utf16 strings.

std::string login()
{
const std::string res = preferences::get("login");
if(res.empty() || res == EMPTY_WRAPPED_STRING) {
char* const login = getenv("USER");
if(login != NULL) {
std::string login = get_system_username();
Copy link
Member

Choose a reason for hiding this comment

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

login could benefit from becoming a const reference, since it previously was a const pointer.

@irydacea
Copy link
Member

irydacea commented Oct 9, 2014

Is there a particular reason some of the newly introduced code breaks our de facto convention of keeping the opening brace for an if body on the same line as the end of the conditional expression?

getenv("USER") doesn't work on windows. Also winapifunctions use utf16
strings.
@gfgtdf
Copy link
Contributor Author

gfgtdf commented Oct 9, 2014

pushed another version.

gfgtdf added a commit that referenced this pull request Oct 9, 2014
@gfgtdf gfgtdf merged commit 65a0783 into wesnoth:master Oct 9, 2014
@gfgtdf gfgtdf deleted the utf16_to_utf32 branch June 2, 2015 21:17
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.

None yet

2 participants