Fix AttributeError and add_update has crashed

- Fixes #500
This commit is contained in:
croneter 2018-06-24 16:05:04 +02:00
parent 75d2557da8
commit aacd882e8b

View file

@ -33,7 +33,6 @@ from logging import getLogger
from re import sub from re import sub
from urllib import urlencode, unquote from urllib import urlencode, unquote
from xbmcgui import ListItem from xbmcgui import ListItem
from xbmcvfs import exists
from .downloadutils import DownloadUtils as DU from .downloadutils import DownloadUtils as DU
from . import clientinfo from . import clientinfo
@ -1594,22 +1593,20 @@ class API(object):
# exist() needs a / or \ at the end to work for directories # exist() needs a / or \ at the end to work for directories
if folder is False: if folder is False:
# files # files
check = exists(utils.try_encode(path)) check = path_ops.exists(path)
else: else:
# directories # directories
checkpath = utils.try_encode(path) if "\\" in path:
if b"\\" in checkpath: if not path.endswith('\\'):
if not checkpath.endswith('\\'):
# Add the missing backslash # Add the missing backslash
check = utils.exists_dir(checkpath + "\\") check = path_ops.exists(path + "\\")
else: else:
check = utils.exists_dir(checkpath) check = path_ops.exists(path)
else: else:
if not checkpath.endswith('/'): if not path.endswith('/'):
check = utils.exists_dir(checkpath + "/") check = path_ops.exists(path + "/")
else: else:
check = utils.exists_dir(checkpath) check = path_ops.exists(path)
if not check: if not check:
if force_check is False: if force_check is False:
# Validate the path is correct with user intervention # Validate the path is correct with user intervention