Daniel Brötzmann pushed to branch master at gajim / gajim

Commits:

1 changed file:

Changes:

  • gajim/gtk/history_export.py
    ... ... @@ -117,7 +117,19 @@ def _on_export(self) -> None:
    117 117
                     continue
    
    118 118
     
    
    119 119
                 file_path = make_path_from_jid(export_dir, jid)
    
    120
    -            file_path.mkdir(parents=True, exist_ok=True)
    
    120
    +            try:
    
    121
    +                file_path.mkdir(parents=True, exist_ok=True)
    
    122
    +            except OSError as err:
    
    123
    +                error_page = cast(ErrorPage, self.get_page('error'))
    
    124
    +                error_page.set_text(
    
    125
    +                    _('An error occurred while trying to create a '
    
    126
    +                      'file at %(path)s: %(error)s') % {
    
    127
    +                          'path': file_path,
    
    128
    +                          'error': str(err)
    
    129
    +                          })
    
    130
    +                self.show_page('error', Gtk.StackTransitionType.SLIDE_LEFT)
    
    131
    +                return
    
    132
    +
    
    121 133
                 with open(file_path / 'history.txt', 'w', encoding='utf-8') as file:
    
    122 134
                     file.write(f'History for {jid}\n\n')
    
    123 135
                     for message in messages: