def exists(path, silent=False, vfs=True): """ Check if there is a folder or file @param path: path @type path: str @rtype: bool @return: Returns True if the path exists, whether it is a folder or a file """ path = encode(path) try: if xbmc_vfs and vfs: result = bool(xbmcvfs.exists(path)) if not result and not path.endswith('/') and not path.endswith( '\\'): result = bool(xbmcvfs.exists(join(path, ' ').rstrip())) return result elif path.lower().startswith("smb://"): return samba.exists(path) else: return os.path.exists(path) except: logger.error("ERROR when checking the path: %s" % path) if not silent: logger.error(traceback.format_exc()) return False
def exists(path, silent=False, vfs=True): """ Comprueba si existe una carpeta o fichero @param path: ruta @type path: str @rtype: bool @return: Retorna True si la ruta existe, tanto si es una carpeta como un archivo """ path = encode(path) try: if xbmc_vfs and vfs: result = bool(xbmcvfs.exists(path)) if not result and not path.endswith('/') and not path.endswith( '\\'): result = bool(xbmcvfs.exists(join(path, ' ').rstrip())) return result elif path.lower().startswith("smb://"): return samba.exists(path) else: return os.path.exists(path) except: logger.error("ERROR al comprobar la ruta: %s" % path) if not silent: logger.error(traceback.format_exc()) return False
def exists(path, silent=False, vfs=True): path = xbmc.translatePath(path) try: if vfs: result = bool(xbmcvfs.exists(path)) if not result and not path.endswith('/') and not path.endswith('\\'): result = bool(xbmcvfs.exists(join(path, ' ').rstrip())) return result elif path.lower().startswith("smb://"): return samba.exists(path) else: return os.path.exists(path) except: logger.error("ERROR when checking the path: %s" % path) if not silent: logger.error(traceback.format_exc()) return False
def exists(path): """ Comprueba si existe una carpeta o fichero @param path: ruta @type path: str @rtype: bool @return: Retorna True si la ruta existe, tanto si es una carpeta como un archivo """ path = encode(path) try: if path.lower().startswith("smb://"): return samba.exists(path) else: return os.path.exists(path) except: logger.error("ERROR al comprobar la ruta: %s" % path) logger.error(traceback.format_exc()) return False
def exists(path): """ Comprueba si existe una carpeta o fichero @param path: ruta @type path: str @rtype: bool @return: Retorna True si la ruta existe, tanto si es una carpeta como un archivo """ path = encode(path) try: if path.lower().startswith("smb://"): return samba.exists(path) else: return os.path.exists(path) except: logger.error("ERROR al comprobar la ruta: %s" %(path)) logger.error(traceback.format_exc()) return False