Skip to content

PathKit: port to Windows#86

Closed
compnerd wants to merge 1 commit into
kylef:masterfrom
compnerd:windows
Closed

PathKit: port to Windows#86
compnerd wants to merge 1 commit into
kylef:masterfrom
compnerd:windows

Conversation

@compnerd

Copy link
Copy Markdown

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.

@djbe djbe left a comment

Copy link
Copy Markdown
Collaborator

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?

Comment thread Sources/PathKit.swift
if (hSearch == INVALID_HANDLE_VALUE) {
return []
}
defer { FindClose(hSearch) }

@djbe djbe Aug 28, 2023

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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
Copy Markdown
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