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

PathKit: port to Windows #86

Closed
wants to merge 1 commit into from
Closed

PathKit: port to Windows #86

wants to merge 1 commit into from

Conversation

compnerd
Copy link

Windows does not provide the Unix glob and fnmatch functions. Emulate these with the closes equivalences (FindFirstFileW and PathMatchSpecExW). This should allow us to use this library on Windows.

This does not cover the tests which will need to be adjusted subsequently.

Windows does not provide the Unix `glob` and `fnmatch` functions.
Emulate these with the closes equivalences (`FindFirstFileW` and
`PathMatchSpecExW`).  This should allow us to use this library on
Windows.
Copy link
Collaborator

@djbe djbe left a comment

Choose a reason for hiding this comment

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

In stencilproject/Stencil#343 you use withUnsafeFileSystemRepresentation to normalise the path (expand ~, etc…). I'm assuming that change will also be needed here? To replace the NSString dependency?

if (hSearch == INVALID_HANDLE_VALUE) {
return []
}
defer { FindClose(hSearch) }
Copy link
Collaborator

@djbe djbe Aug 28, 2023

Choose a reason for hiding this comment

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

Shouldn't this defer be above that first if?

Edit: or is it because you can't close an invalid handle 🤔

Copy link
Author

Choose a reason for hiding this comment

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

The edit is correct - it would close an invalid handle.

@compnerd
Copy link
Author

Turns out that this is woefully insufficient and the changes required to support this is too invasive. I'm going to close this for now, feel free to use it as a base if you feel motivated to port the library.

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