Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
check texture names against safe known extensions #3
for documentation purpose, that was how looked the error before this fix:
Traceback (most recent call last): File "…/sloth.py", line 1103, in <module> sg.generateSet(path, setname = a.root, cutextension = a.strip) File "…/sloth.py", line 643, in generateSet self.__analyzeMaps(shader) File "…/sloth.py", line 399, in __analyzeMaps img = Image.open(shader["abspath"]+os.path.sep+shader["diffuse"]+shader["ext"]["diffuse"], "r") File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2349, in open % (filename if filename else fp)) OSError: cannot identify image file '…/UnvanquishedAssets/src/tex-exm_src.dpkdir/textures/shared_exm_src/floor_grate2_trans_d.xcf'
Sorry for the delay.
Note that with my proposed changes, this PR does not fix #1 anymore. The real problem behind #1 is that the input can be ambiguous. Not just if one file is a
I think I'd favor (1) or (2) for simplicity.
Hmm, having both the
This solution relies on a well-known format/extension list. Well, the only need I have is to exclude source files (
The current solution (trying to read file and intercept exception if it fails) is going on that 3rd path, but do we need something very complex ? My first priority is to get legit use case working (like a source repository with
The main issue I have with your current approach is that you are completely ignoring files that Sloth can't read, even though Dæmon may be able to. For instance, if one only has
The second issue I have with your approach is that you load every single texture map, which is slow/expensive.
Apart from that, I'm not asking for a debugger, the solution can be simple!
If you want to maintain a blacklist, that's fine by me. In case you dislike hardcoding either a white- or a blacklist, feel free to add a command line argument to specify the white- or blacklist, with some sensible default argument.