SublimeText / sublime_lib

Utility library for frequently used functionality in Sublime Text and convenience functions or classes
https://sublimetext.github.io/sublime_lib
MIT License
52 stars 4 forks source link

Fix glob bug. #157

Closed Thom1729 closed 3 years ago

Thom1729 commented 3 years ago

For #134.

After much research and testing, I determined that the fundamental bug was that every pattern component except for ** should match at least one character — so /A*B/ should match AB, but A/* shouldn't match A/. This behavior should match other glob engines and resolve the linked bug.

This behavior varies slightly from sublime.find_resources('*'), which will find all resources (like sublime.find_resources('').

It's probably bad news for other reasons if sublime.find_resources() returns directories, but at least now it shouldn't be bad news for us in particular.

Thom1729 commented 3 years ago

N.B. In order to directly test #134, we'd have to create a zipfile with directory entries, which I'm not sure how to do within Python.

FichteFoll commented 3 years ago

N.B. In order to directly test #134, we'd have to create a zipfile with directory entries, which I'm not sure how to do within Python.

Yeah, I tried writing such a file with the zipfile module, but you can't create "files" with trailing slashes. I suppose we need to bundle such a zip as an artifact.

Thom1729 commented 3 years ago

I suppose we need to bundle such a zip as an artifact.

Ugh. You're probably right, but still ugh. I've opened a question on Stack Overflow looking for an alternative.

Thom1729 commented 3 years ago

Do you think this can be merged as-is, punting the direct zipfile test to a future PR?