Conversation
I was procrastinating this for way too long already. But as expected, it was an immense load of pain.
Sigh. Not one day passes where I would just carry on coding against APIs that are neither crap nor buggy.
Unfortunate. I don't want the application to complain give me the same error when a directory doesn't contain any *.txt files or when the directory doesn't exist at all. The Path::glob() tests now fully pass.
…mes. Wonderful, eh? The file.txtlol becomes something like FILE~1.TXT, with only three letters from the extension used and the rest ignored. Discovered completely by accident while trying to port PluginManager plugin discovery to Path::glob() and it matched *.modconf files where it should be matching just *.mod.
If someone told me, 10 hours ago, that I would run into problems like this, I would just say fuck it and not even attempt to implement this function. Well, here we are. TODO: AND OF COURSE THIS CHANGE DOESN'T HAVE ANY EFFECT! FFS!! TODO: so i guess here i'd need to implement this BY HAND?! Even though I'm forced to pass * to the damn thing to list stuff in the first place?! God fucking dammit. TODO: https://devblogs.microsoft.com/oldnewthing/20050720-16/?p=34883 HEY RAYMOND INSTEAD OF SAYING "CAN'T DO" OR "IMPOSSIBLE", WHY COULDN'T YOU JUST ADD ONE MORE FLAG TO THE EX FUNCTION?? IT'S BEEN 17 YEARS SINCE THAT POST!!!
Halves the number of string allocations as we're skipping all *.conf files this way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[11:10] "hmm, let's stop procrastinating and add the
Path::glob(), finally, can't be that hard"[21:25] WHERE IS MY FLAMETHROWER
When I hit a bug in musl, which is used by Emscripten, I thought "okay fine, one minor wart, easy to workaround". When I hit another bug in an older version of musl, used by older Emscripten, which was impossible to workaround, I said "fine, let's just XFAIL this case". When I subsequently discovered that Windows conflates the error for "directory doesn't exist" and "no matching files found in said directory" I was a bit shaken already, but still managed to invent a workaround that isn't too complex.
But when I saw that the Windows CI is getting stuck on an ASSERT DIALOG BOX THAT I HAVE TO CLICK because I changed PluginManager to use
glob()instead oflist()+if(!filename.hasSuffix(ext)) continue;, and the error was that it matched a*.modconfinstead of a*.modfile (and gotta say, I was lucky to have that test case uncover this GIANT problem), I started getting furious. Then, I discovered this amazing answer, and thought "okay, silly defaults and over-the-top backwards compatibility, I can understand".Implemented, pushed ...and nothing changed. The reduced repro case matching
*.txtfiles still matched also*.txtlol. Ultimately, what made me snap, was this post from Raymond Chen. YES, AMAZING JOB EXPLAINING HOW YOU "CAN'T" OR "IMPOSSIBLE" OR "OUT OF QUESTION". IT'S BEEN 17 YEARS SINCE THAT POST, WHY DOES IT TAKE SO DAMN LONG TO ADD ONE MORE FLAG TO FIX THIS?! TheFindFirstFileEx()has so many possible extension points it makes me sweat, and yet there's still this damn issue where*.xlsmatches also*.xlsx,*.datalso*.data, THE WHOLE WORLD SUFFERS and you do nothing!!So, since this is impossible, other options:
FindFirstFileEx()call because it does not add any value*.docx,*.xlsx, ...). Am I Microsoft? No I'm not!fnmatch(), on Windows there seems to be ... PathMatchSpecEx that I could use as a post-glob filter? "Nice?" I even forgot such word existed.list()usingglob()on Windows, revert thatBulldog.dllthat a*.dllquery cannot find it?! Figure out and fix. I hope it's something silly and not the damn glob not returning files it should besides returning files it shouldn't, because then it would be really crappy.path/to/symlinked-dir/../*.txtmay look somewhere entirely different thanpath/to/Path::normalize()and/orPath::realPath()