Added file check to icon changing.

This commit is contained in:
Joey Payne 2014-10-19 15:23:16 +13:00
commit 6eb2006269

4
pe.py
View file

@ -1222,10 +1222,14 @@ class PEFile(Printable):
of the file, but that did not work. Comments were left as history
to what I attempted.
"""
icon_path = os.path.expanduser(icon_path)
if pm is None:
raise Exception('PythonMagick is required to run this function.')
if not os.path.exists(icon_path):
raise Exception('Icon {} does not exist'.format(icon_path))
resource_section = self.sections['.rsrc']
g_icon_dir = self.get_directory_by_type(ResourceTypes.Group_Icon)