Merge pull request #2573 from sigmabeta/android-show-filenames

Android: Show filenames for games with an empty title.
This commit is contained in:
Ryan Houdek 2015-06-08 19:35:17 -04:00
commit 2282be3265
1 changed files with 9 additions and 1 deletions

View File

@ -152,8 +152,16 @@ public final class GameDatabase extends SQLiteOpenHelper
// Check that the file has an extension we care about before trying to read out of it. // Check that the file has an extension we care about before trying to read out of it.
if (allowedExtensions.contains(fileExtension)) if (allowedExtensions.contains(fileExtension))
{ {
String name = NativeLibrary.GetTitle(filePath);
// If the game's title field is empty, use the filename.
if (name.isEmpty())
{
name = filePath.substring(filePath.lastIndexOf("/") + 1);
}
ContentValues game = Game.asContentValues(NativeLibrary.GetPlatform(filePath), ContentValues game = Game.asContentValues(NativeLibrary.GetPlatform(filePath),
NativeLibrary.GetTitle(filePath), name,
NativeLibrary.GetDescription(filePath).replace("\n", " "), NativeLibrary.GetDescription(filePath).replace("\n", " "),
NativeLibrary.GetCountry(filePath), NativeLibrary.GetCountry(filePath),
filePath, filePath,