Fix #320: argv is str
but our filenames must be unicode
TODO: figure out why argparse sometimes gets the exe as a filename
This commit is contained in:
parent
39add23d5f
commit
59f3c0bb92
@ -487,12 +487,18 @@ class MCEditApp(QtGui.QApplication):
|
||||
|
||||
for filename in self.args.filename:
|
||||
try:
|
||||
# we use `unicode` filenames, but argv is `str`
|
||||
# should only get `str` on linux/osx - need to get wargv on windows
|
||||
if isinstance(filename, str):
|
||||
filename = filename.decode(sys.getfilesystemencoding())
|
||||
if os.path.exists(filename):
|
||||
self.commandLineWorlds.append(filename)
|
||||
else:
|
||||
log.info("File not found: %s", filename)
|
||||
except EnvironmentError as e:
|
||||
log.info("%r", e)
|
||||
except UnicodeDecodeError as e:
|
||||
log.info("%r", e)
|
||||
|
||||
# --- Language Menu ---
|
||||
|
||||
|
@ -187,6 +187,7 @@ def startup():
|
||||
|
||||
from mcedit2 import support_modules
|
||||
|
||||
# TODO: get wchar_t argv from windows
|
||||
editorApp = MCEditApp(sys.argv)
|
||||
editorApp.startup()
|
||||
|
||||
|
Reference in New Issue
Block a user