mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Catch a file error when saving recent scans. Fixes #1177
This commit is contained in:
@@ -767,9 +767,18 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
|
|||||||
scan_interface.saved_filename = directory
|
scan_interface.saved_filename = directory
|
||||||
|
|
||||||
# Saving recent scan information
|
# Saving recent scan information
|
||||||
|
try:
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
recent_scans.add_recent_scan(filename)
|
recent_scans.add_recent_scan(filename)
|
||||||
recent_scans.save()
|
recent_scans.save()
|
||||||
|
except (OSError, IOError), e:
|
||||||
|
alert = HIGAlertDialog(
|
||||||
|
message_format=_(
|
||||||
|
"Can't save recent scan information"),
|
||||||
|
secondary_text=_(
|
||||||
|
"Can't open file to write.\n%s") % str(e))
|
||||||
|
alert.run()
|
||||||
|
alert.destroy()
|
||||||
|
|
||||||
def _save(self, scan_interface, saved_filename, selected_index,
|
def _save(self, scan_interface, saved_filename, selected_index,
|
||||||
format="xml"):
|
format="xml"):
|
||||||
@@ -794,8 +803,17 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
|
|||||||
|
|
||||||
if format == "xml":
|
if format == "xml":
|
||||||
# Saving recent scan information
|
# Saving recent scan information
|
||||||
|
try:
|
||||||
recent_scans.add_recent_scan(saved_filename)
|
recent_scans.add_recent_scan(saved_filename)
|
||||||
recent_scans.save()
|
recent_scans.save()
|
||||||
|
except (OSError, IOError), e:
|
||||||
|
alert = HIGAlertDialog(
|
||||||
|
message_format=_(
|
||||||
|
"Can't save recent scan information"),
|
||||||
|
secondary_text=_(
|
||||||
|
"Can't open file to write.\n%s") % str(e))
|
||||||
|
alert.run()
|
||||||
|
alert.destroy()
|
||||||
|
|
||||||
def get_empty_interface(self):
|
def get_empty_interface(self):
|
||||||
"""Return this window if it is empty, otherwise create and return a new
|
"""Return this window if it is empty, otherwise create and return a new
|
||||||
|
|||||||
Reference in New Issue
Block a user