Fix some file browsing issues

This commit is contained in:
Henrik Rydgard 2013-08-20 16:52:36 +02:00
parent ff7c370ecf
commit c1d0ed08c4
4 changed files with 27 additions and 13 deletions

View File

@ -51,6 +51,7 @@ IdentifiedFileType Identify_File(std::string &filename)
}
if (info.isDirectory) {
if (filename.size() > 4) {
FileInfo ebootInfo;
// Check for existence of EBOOT.PBP, as required for "Directory games".
if (getFileInfo((filename + "/EBOOT.PBP").c_str(), &ebootInfo)) {
@ -67,6 +68,9 @@ IdentifiedFileType Identify_File(std::string &filename)
}
}
return FILETYPE_NORMAL_DIRECTORY;
}
FILE *f = fopen(filename.c_str(), "rb");
if (!f) {
// File does not exists
@ -198,6 +202,10 @@ bool LoadFile(std::string &filename, std::string *error_string) {
*error_string = "File is compressed (ZIP).\nPlease decompress first (try WinRAR)";
break;
case FILETYPE_NORMAL_DIRECTORY:
ERROR_LOG(LOADER, "Just a directory.");
break;
case FILETYPE_UNKNOWN_BIN:
case FILETYPE_UNKNOWN_ELF:
case FILETYPE_UNKNOWN:

View File

@ -37,6 +37,8 @@ enum IdentifiedFileType {
FILETYPE_ARCHIVE_ZIP,
FILETYPE_PSP_PS1_PBP,
FILETYPE_NORMAL_DIRECTORY,
FILETYPE_UNKNOWN
};

View File

@ -288,6 +288,10 @@ public:
break;
}
case FILETYPE_NORMAL_DIRECTORY:
info_->title = gamePath_;
break;
default:
{
std::string fn, ext;

View File

@ -386,7 +386,7 @@ void GameBrowser::Refresh() {
std::vector<FileInfo> fileInfo;
path_.GetListing(fileInfo, "iso:cso:pbp:elf:prx:");
for (size_t i = 0; i < fileInfo.size(); i++) {
if (fileInfo[i].isDirectory && !File::Exists(path_.GetPath() + fileInfo[i].name + "/EBOOT.PBP")) {
if (fileInfo[i].isDirectory && (path_.GetPath().size() < 4 || !File::Exists(path_.GetPath() + fileInfo[i].name + "/EBOOT.PBP"))) {
// Check if eboot directory
if (allowBrowsing_)
dirButtons.push_back(new UI::Button(fileInfo[i].name.c_str(), new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)));