New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check texture names against safe known extensions #3
Conversation
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. |
I'm closing this PR because obsolete and the thread is going the "too much" way. See #6 for an alternative fulfilling the initial need. Other improvements talked about may be done as dedicated PR instead. |
fix #1