Merge pull request #210 from cuu/master

except the python UnicodeDecodeError in Emulator
This commit is contained in:
GNU 2019-05-13 19:48:13 +08:00 committed by GitHub
commit a9220fc66e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -129,8 +129,11 @@ class FavListPage(Page):
stats = os.stat(v)
if stats.st_gid != self._Parent._FavGID: ## only favs
continue
try:
dirmap["gamedir"] = v.decode("utf8","ignore")
except:
dirmap["gamedir"] = v.decode("ascii","ignore")
dirmap["gamedir"] = v.decode("utf8")
ret.append(dirmap)
if os.path.isfile(v) and self._Emulator["FILETYPE"] == "file":
stats = os.stat(v)
@ -141,7 +144,11 @@ class FavListPage(Page):
pieces = bname.split(".")
if len(pieces) > 1:
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
dirmap["file"] = v.decode("utf8")
try:
dirmap["file"] = v.decode("utf8","ignore")
except:
dirmap["file"] = v.decode("ascii","ignore")
ret.append(dirmap)
# else:

View File

@ -143,7 +143,11 @@ class RomListPage(Page):
continue
if FileExists(v+"/"+gameshell_bat):
dirmap["gamedir"] = v.decode("utf8")
try:
dirmap["gamedir"] = v.decode("utf8","ignore")
except:
dirmap["gamedir"] = v.decode("ascii","ignore")
ret.append(dirmap)
if os.path.isfile(v) and self._Emulator["FILETYPE"] == "file":
stats = os.stat(v)
@ -162,7 +166,11 @@ class RomListPage(Page):
pieces = bname.split(".")
if len(pieces) > 1:
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
dirmap["file"] = v.decode("utf8")
try:
dirmap["file"] = v.decode("utf8","ignore")
except:
dirmap["file"] = v.decode("ascii","ignore")
ret.append(dirmap)
# else:
# print("not file or dir")