Browse files

Ensure only .xml files get passed to LoadKeymap

  • Loading branch information...
1 parent 120659d commit 7a0bad66272ee3b4075f6478ac62c1dabc7d085a John Rennie committed Nov 17, 2011
Showing with 8 additions and 4 deletions.
  1. +8 −4 xbmc/input/ButtonTranslator.cpp
View
12 xbmc/input/ButtonTranslator.cpp
@@ -387,10 +387,12 @@ bool CButtonTranslator::Load(const char* szDevice)
{
CFileItemList files;
XFILE::CDirectory::GetDirectory(DIRS_TO_CHECK[dirIndex], files, "*.xml");
- //sort the list for filesystem based priorities, e.g. 01-keymap.xml, 02-keymap-overrides.xml
+ // Sort the list for filesystem based priorities, e.g. 01-keymap.xml, 02-keymap-overrides.xml
files.Sort(SORT_METHOD_FILE, SORT_ORDER_ASC);
+ // In (at least) Windows the GetDirectory returns all files not just *.xml files
for(int fileIndex = 0; fileIndex<files.Size(); ++fileIndex)
- success |= LoadKeymap(files[fileIndex]->GetPath());
+ if (files[fileIndex]->GetPath().Right(4) == ".xml")
+ success |= LoadKeymap(files[fileIndex]->GetPath());
}
}
@@ -438,10 +440,12 @@ bool CButtonTranslator::Load(const char* szDevice)
{
CFileItemList files;
XFILE::CDirectory::GetDirectory(devicedir, files, "*.xml");
- //sort the list for filesystem based priorities, e.g. 01-keymap.xml, 02-keymap-overrides.xml
+ // Sort the list for filesystem based priorities, e.g. 01-keymap.xml, 02-keymap-overrides.xml
files.Sort(SORT_METHOD_FILE, SORT_ORDER_ASC);
+ // In (at least) Windows the GetDirectory returns all files not just *.xml files
for(int fileIndex = 0; fileIndex<files.Size(); ++fileIndex)
- success |= LoadKeymap(files[fileIndex]->GetPath());
+ if (files[fileIndex]->GetPath().Right(4) == ".xml")
+ success |= LoadKeymap(files[fileIndex]->GetPath());
}
}
}

0 comments on commit 7a0bad6

Please sign in to comment.