Skip to content

Commit

Permalink
Merge pull request #112 from Samweli/fix_windows_folder_opening
Browse files Browse the repository at this point in the history
Fix error when opening reports
  • Loading branch information
Samweli authored Oct 18, 2024
2 parents 53d1470 + 206d704 commit e1eeeb8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/qgis_gea_plugin/gui/report_progress_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,17 @@ def _on_open_pdf_folder(self):
if os.path.exists(str(self.report_output_dir)):
current_os = platform.system()

if current_os == "Windows":
os.startfile(self.report_output_dir)
elif current_os == "Darwin": # macOS
subprocess.run(['open', self.report_output_dir])
elif current_os == "Linux":
subprocess.run(['xdg-open', self.report_output_dir])
else:
log(f"Unsupported OS: {current_os}")
subprocess.run(['xdg-open', self.report_output_dir])
try:
if current_os == "Windows":
os.startfile(self.report_output_dir)
elif current_os == "Darwin": # macOS
subprocess.run(['open', self.report_output_dir])
elif current_os == "Linux":
subprocess.run(['xdg-open', self.report_output_dir])
else:
log(f"Unsupported OS: {current_os}")
except Exception as e:
log(f"Exception occurred when opening pdf folder, {e}")
else:
log("Folder path doesn't exist")
else:
Expand Down

0 comments on commit e1eeeb8

Please sign in to comment.