-
Notifications
You must be signed in to change notification settings - Fork 96
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
Whitelisting of extensions for consoles #92
Conversation
…alid rom' method to console instead of emulator.
…alid rom' method to console instead of emulator.
…alid rom' method to console instead of emulator.
…alid rom' method to console instead of emulator.
…alid rom' method to console instead of emulator.
…alid rom' method to console instead of emulator.
…alid rom' method to console instead of emulator.
…alid rom' method to console instead of emulator.
You probably should just remove them from your commit. |
|
||
if self.extensions == "": | ||
return True | ||
return any(path.lower().endswith('.'+x) for x in self.extensions.split(' ')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: os.path
provides a helper function to split a file extension away from a path. The function you want is
http://docs.python.org/2/library/os.path.html#os.path.splitext
Please change the logic to check if it ends with the extension to use this function. It should look something like:
(Note: no guarantees on the one-liner tuple syntax)
return any(path.endswith(os.path.splitext(path)[1]) for x in self.extensions.split(' '))
Also, would you make the list comma-separated instead of space-separated? It's sort of a personal preference, but I feel that commas convey the concept of a list much better than spaces do.
Extensions list may now be comma delimited (I trim each extension too for good measure). Also I don't ruin the existing config files this time around. My apologies for the mess - I've always been a lurker rather than a contributor |
Whitelisting of extensions for consoles
This small edit allows you to supply a number of accepted file extensions for consoles.
When checking for roms, Ice will validate the file path against the whitelist. If no extensions are entered, or the extensions parameter in consoles.txt is omitted, all roms will be accepted.
Reasons to use this:
My apologies for the unnecessary edits with line breaks - a result of my using Linux. I'll see about fixing that for future pull requests :)