def fixKeymaps():
# Fix the keymap file name if it's been changed or the old name was being used
name = getKeyMapsFileName()
old = getOldKeyMapsFileName()
dir = getKeyMapsPath("*")
full_name = getKeyMapsPath(name)
try:
debugTrace("Getting contents of keymaps directory " + dir)
files = (glob.glob(dir))
if not full_name in files and len(files) > 0:
for file in files:
if (name in file) or (old in file):
infoTrace("common.py", "Renaming " + file + " to " + full_name)
xbmcvfs.rename(file, full_name)
xbmc.sleep(100)
# Wait 10 seconds for rename to happen otherwise quit and let it fail in the future
for i in range(0, 9):
if xbmcvfs.exists(full_name): break
xbmc.sleep(1000)
return True
except Exception as e:
errorTrace("common.py", "Problem fixing the keymap filename.")
errorTrace("common.py", str(e))
return False
评论列表
文章目录