diff --git a/aqt/exporting.py b/aqt/exporting.py index bc373b077..3d80266b4 100644 --- a/aqt/exporting.py +++ b/aqt/exporting.py @@ -64,13 +64,20 @@ class ExportDialog(QDialog): self.exporter.did): verbatim = True # it's a verbatim apkg export, so place on desktop instead of - # choosing file + # choosing file; use homedir if no desktop + usingHomedir = False file = os.path.join(QDesktopServices.storageLocation( QDesktopServices.DesktopLocation), "collection.apkg") + if not os.path.exists(os.path.dirname(file)): + usingHomedir = True + file = os.path.join(QDesktopServices.storageLocation( + QDesktopServices.HomeLocation), "collection.apkg") if os.path.exists(file): - if not askUser( - _("%s already exists on your desktop. Overwrite it?")% - "collection.apkg"): + if usingHomedir: + question = _("%s already exists in your home directory. Overwrite it?") + else: + question = _("%s already exists on your desktop. Overwrite it?") + if not askUser(question % "collection.apkg"): return else: verbatim = False @@ -100,7 +107,11 @@ class ExportDialog(QDialog): os.unlink(file) self.exporter.exportInto(file) if verbatim: - msg = _("A file called collection.apkg was saved on your desktop.") + if usingHomedir: + msg = _("A file called %s was saved in your home directory.") + else: + msg = _("A file called %s was saved on your desktop.") + msg = msg % "collection.apkg" period = 5000 else: period = 3000