Added error checking around all calls to FSNode.listDir(), to actually

check and see if we're dealing with a directory.

Fixed off-by-one error in count for files in LauncherDialog.  While in
ROM browse mode, the previous dir " [..]" entry should not be counted.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1194 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-12-09 04:02:40 +00:00
parent 9c8572124f
commit 935e0bd6a8
2 changed files with 10 additions and 3 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: BrowserDialog.cxx,v 1.21 2006-12-08 16:49:32 stephena Exp $
// $Id: BrowserDialog.cxx,v 1.22 2006-12-09 04:02:40 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -162,6 +162,9 @@ void BrowserDialog::handleCommand(CommandSender* sender, int cmd,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void BrowserDialog::updateListing()
{
if(!_node.isDirectory())
return;
// Update the path display
_currentPath->setLabel(_node.path());

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: LauncherDialog.cxx,v 1.60 2006-12-08 16:49:35 stephena Exp $
// $Id: LauncherDialog.cxx,v 1.61 2006-12-09 04:02:40 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -239,7 +239,8 @@ void LauncherDialog::updateListing(bool fullReload)
// Indicate how many files were found
ostringstream buf;
buf << myGameList->size() << " items found";
buf << (myBrowseModeFlag ? myGameList->size() -1 : myGameList->size())
<< " items found";
myRomCount->setLabel(buf.str());
// Restore last selection
@ -277,6 +278,9 @@ void LauncherDialog::updateListing(bool fullReload)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::loadDirListing()
{
if(!myCurrentNode.isDirectory())
return;
FSList files = myCurrentNode.listDir(FilesystemNode::kListAll);
// Add '[..]' to indicate previous folder