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

Windows: Replace FindFirstFile with GetFileAttributesExA and fix UNICODE builds #170

Closed
wants to merge 1 commit into from

Conversation

Ghabry
Copy link
Contributor

@Ghabry Ghabry commented Jun 3, 2017

Replaced FindFirstFile with FileAttributesEx because the API is more suitable for quering information.

When WildMidi is compiled with UNICODE defined the WinApi functions expect UTF16 strings and FindFirstFile fails. I explictly use the A (ANSI) Api to mitigate this. (this matches the remaining functions like "open" a few lines later.

Only limitation is that wildmidi.cfg can't be in a path that has special characters outside of the current "local codepage" (see MSDN). Don't think it makes sense to make the API Unicode aware, who would put wildmidi in C:\日本\йцук\wildmidi.cfg.

Explicitly use the Ansi (A) API, otherwise builds with UNICODE defined will fail because the W-API expects utf16 strings.
@sezero
Copy link
Contributor

sezero commented Jun 3, 2017

So actually switching to explicit FindFirstFileA() / WIN32_FIND_DATAA is enough, yes?

@Ghabry
Copy link
Contributor Author

Ghabry commented Jun 3, 2017

yes

@psi29a
Copy link
Member

psi29a commented Jun 3, 2017

LGTM, the failures are due to changes travis-ci OSX changes with pkg-config.

sezero added a commit that referenced this pull request Jun 3, 2017
@sezero
Copy link
Contributor

sezero commented Jun 3, 2017

Applied 858618

@sezero sezero closed this Jun 3, 2017
@psi29a
Copy link
Member

psi29a commented Jun 4, 2017

Thank you @Ghabry and @sezero!

sezero added a commit that referenced this pull request Mar 6, 2018
@sezero
Copy link
Contributor

sezero commented Mar 6, 2018

Backported the fix to wildmidi-0.3: commit fc446be

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.

3 participants