mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
don't decode file argument as unicode; tell user to file>import if broken
When the file to import has non-latin characters in its path, we're not handling the provided filename correctly. I tried decoding with sys.getfilesystemencoding() with no luck, so this needs more looking into. In the mean time, if we can't open the path name, tell the user to File>Import the file instead.
This commit is contained in:
parent
ca2f9acce2
commit
0ace93e717
2 changed files with 2 additions and 3 deletions
|
@ -128,7 +128,6 @@ class AnkiApp(QApplication):
|
||||||
self._srv = QLocalServer(self)
|
self._srv = QLocalServer(self)
|
||||||
self.connect(self._srv, SIGNAL("newConnection()"), self.onRecv)
|
self.connect(self._srv, SIGNAL("newConnection()"), self.onRecv)
|
||||||
self._srv.listen(self.KEY)
|
self._srv.listen(self.KEY)
|
||||||
# if we were given a file on startup, send import it
|
|
||||||
else:
|
else:
|
||||||
# we accept only one command line argument. if it's missing, send
|
# we accept only one command line argument. if it's missing, send
|
||||||
# a blank screen to just raise the existing window
|
# a blank screen to just raise the existing window
|
||||||
|
@ -155,7 +154,7 @@ class AnkiApp(QApplication):
|
||||||
sys.stderr.write(sock.errorString())
|
sys.stderr.write(sock.errorString())
|
||||||
return
|
return
|
||||||
buf = sock.readAll()
|
buf = sock.readAll()
|
||||||
self.emit(SIGNAL("appMsg"), unicode(buf))
|
self.emit(SIGNAL("appMsg"), buf)
|
||||||
sock.disconnectFromServer()
|
sock.disconnectFromServer()
|
||||||
|
|
||||||
# OS X file/url handler
|
# OS X file/url handler
|
||||||
|
|
|
@ -1055,6 +1055,6 @@ Please ensure a profile is open and Anki is not busy, then try again."""),
|
||||||
return
|
return
|
||||||
# import
|
# import
|
||||||
if not os.path.exists(buf):
|
if not os.path.exists(buf):
|
||||||
return showInfo(_("Provided file does not exist."))
|
return showInfo(_("Please use File>Import to import this file."))
|
||||||
import aqt.importing
|
import aqt.importing
|
||||||
aqt.importing.importFile(self, buf)
|
aqt.importing.importFile(self, buf)
|
||||||
|
|
Loading…
Reference in a new issue