Closed apocalyptech closed 3 years ago
Ah, well now that I've had more time to think, I do remember that folks were having issues with pathname lengths when extracting game data, if they'd started too "deep." So yeah, that Windows path checking must be a thing. Anyway, let me know if you'd like this cleaned up and submitted anyway. :)
Didn't realize Linux had a 255 filename limit so it'd be good to add (haven't tested on Linux actually).
Windows does support long paths, but some programs have trouble handling that, python being one of them (will raise exceptions with paths longer than 255, even if filenames are less).
Feel free to submit (or I can add it if you prefer), probably needs to include self.txtpcache.trims += 1
+ logging, and maybe set a flag so Windows path trimming doesn't add +1 again.
Okay, sure thing -- I'll take a stab at doing this properly, then. :) Will probably be a day or two!
went ahead and added that code since it was just a few lines
Oh shoot, sorry; I'd said I was going to work on it and then ended up totally forgetting about it. :) Thx for merging it in, cheers!
So I ran into some filenames which were too long on Linux, and a perusal of https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits suggests that support for filenames longer than 255 characters is practically unheard of (though there are a couple exceptions). I see that the code is already enforcing a maximum 240-char full path on Windows (which might not be necessary, given that link above?), but I've added in a 240-char limit on the filename itself, as well. I was using this patch to do so:
... the filenames there would actually be likely to approach 250 chars or so, since I just cut it off at 240 and then add the
.created
index plus.txtp
. If you wanted this as a PR instead, I could clean it up and send it through that way. I wasn't sure if you'd like this implementation at all, though, or if you'd approve of my hijacking oflongname
in there. I also wonder if the Windows-specific check should be taken out, unless there really is a tighter pathname limit than I'm aware of.