Fix Linux parsing of .ppsspp-index.lst file.

This commit is contained in:
Unknown W. Brackets
2013-07-28 15:36:27 -07:00
parent c91c07c89d
commit 8505d255fc

View File

@@ -101,13 +101,19 @@ void VirtualDiscFileSystem::LoadFileListIndex() {
size_t handler_pos = line.find(':', filename_pos);
if (handler_pos != line.npos) {
entry.fileName = line.substr(filename_pos + 1, handler_pos - filename_pos - 1);
std::string handler = line.substr(handler_pos + 1);
std::string handler = line.substr(handler_pos + 1).c_str();
size_t trunc = handler.find_last_not_of("\r\n");
if (trunc != handler.npos && trunc != handler.size())
handler.resize(trunc + 1);
if (handlers.find(handler) == handlers.end())
handlers[handler] = new Handler(handler.c_str(), this);
entry.handler = handlers[handler];
} else {
entry.fileName = line.substr(filename_pos + 1);
entry.fileName = line.substr(filename_pos + 1).c_str();
}
size_t trunc = entry.fileName.find_last_not_of("\r\n");
if (trunc != entry.fileName.npos && trunc != entry.fileName.size())
entry.fileName.resize(trunc + 1);
entry.firstBlock = strtol(line.c_str(), NULL, 16);
if (entry.handler != NULL && entry.handler->IsValid()) {