BACKENDS: Use FSNode::getName in string operations
This commit is contained in:
parent
8c86319923
commit
c9d67e48a9
10 changed files with 20 additions and 20 deletions
|
@ -80,7 +80,7 @@ void DownloadFileHandler::handle(Client &client) {
|
|||
GetClientHandler *handler = new GetClientHandler(stream);
|
||||
handler->setResponseCode(200);
|
||||
handler->setHeader("Content-Type", "application/force-download");
|
||||
handler->setHeader("Content-Disposition", "attachment; filename=\"" + node->getDisplayName() + "\"");
|
||||
handler->setHeader("Content-Disposition", "attachment; filename=\"" + node->getName() + "\"");
|
||||
handler->setHeader("Content-Transfer-Encoding", "binary");
|
||||
client.setHandler(handler);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ bool FilesPageHandler::listDirectory(Common::String path, Common::String &conten
|
|||
|
||||
// fill the content
|
||||
for (Common::FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) {
|
||||
Common::String name = i->getDisplayName();
|
||||
Common::String name = i->getName();
|
||||
if (i->isDirectory())
|
||||
name += "/";
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ Common::JSONObject ListAjaxHandler::listDirectory(Common::String path) {
|
|||
|
||||
// fill the content
|
||||
for (Common::FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) {
|
||||
Common::String name = i->getDisplayName();
|
||||
Common::String name = i->getName();
|
||||
if (i->isDirectory()) name += "/";
|
||||
|
||||
Common::String filePath = i->getPath();
|
||||
|
|
|
@ -157,7 +157,7 @@ static Game the_game;
|
|||
|
||||
static bool isIcon(const Common::FSNode &entry)
|
||||
{
|
||||
return entry.getDisplayName().hasSuffixIgnoreCase(".ICO");
|
||||
return entry.getName().hasSuffixIgnoreCase(".ICO");
|
||||
}
|
||||
|
||||
static bool loadIcon(Game &game, Dir *dirs, int num_dirs)
|
||||
|
@ -269,7 +269,7 @@ static int findGames(Game *games, int max, bool use_ini)
|
|||
files.push_back(*entry);
|
||||
} else
|
||||
if (isIcon(*entry))
|
||||
strcpy(dirs[curr_dir-1].deficon, entry->getDisplayName().c_str());
|
||||
strcpy(dirs[curr_dir-1].deficon, entry->getName().c_str());
|
||||
else if(!use_ini)
|
||||
files.push_back(*entry);
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ static int findPluginDirs(Game *plugin_dirs, int max, const Common::FSNode &base
|
|||
if (curr_dir >= max)
|
||||
break;
|
||||
strncpy(plugin_dirs[curr_dir].dir, (*entry).getPath().c_str(), 256);
|
||||
strncpy(plugin_dirs[curr_dir].text, (*entry).getDisplayName().c_str(), 256);
|
||||
strncpy(plugin_dirs[curr_dir].text, (*entry).getName().c_str(), 256);
|
||||
plugin_dirs[curr_dir].icon.load(NULL, 0, 0);
|
||||
curr_dir++;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ bool FSNode::operator<(const FSNode& node) const {
|
|||
|
||||
// If both nodes are of the same type (two files or two dirs),
|
||||
// then sort by name, ignoring case.
|
||||
return getDisplayName().compareToIgnoreCase(node.getDisplayName()) < 0;
|
||||
return getName().compareToIgnoreCase(node.getName()) < 0;
|
||||
}
|
||||
|
||||
bool FSNode::exists() const {
|
||||
|
|
|
@ -318,21 +318,21 @@ Common::Archive *ResLoaderPak::load(Common::ArchiveMemberPtr memberFile, Common:
|
|||
while (!stream.eos()) {
|
||||
// The start offset of a file should never be in the filelist
|
||||
if (startoffset < stream.pos() || startoffset > filesize || startoffset < 0) {
|
||||
warning("PAK file '%s' is corrupted", memberFile->getDisplayName().c_str());
|
||||
warning("PAK file '%s' is corrupted", memberFile->getName().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
file = readString(stream);
|
||||
|
||||
if (stream.eos()) {
|
||||
warning("PAK file '%s' is corrupted", memberFile->getDisplayName().c_str());
|
||||
warning("PAK file '%s' is corrupted", memberFile->getName().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Quit now if we encounter an empty string
|
||||
if (file.empty()) {
|
||||
if (firstFile) {
|
||||
warning("PAK file '%s' is corrupted", memberFile->getDisplayName().c_str());
|
||||
warning("PAK file '%s' is corrupted", memberFile->getName().c_str());
|
||||
return 0;
|
||||
} else {
|
||||
break;
|
||||
|
@ -343,7 +343,7 @@ Common::Archive *ResLoaderPak::load(Common::ArchiveMemberPtr memberFile, Common:
|
|||
endoffset = switchEndian ? stream.readUint32BE() : stream.readUint32LE();
|
||||
|
||||
if (endoffset < 0 && stream.pos() != firstOffset) {
|
||||
warning("PAK file '%s' is corrupted", memberFile->getDisplayName().c_str());
|
||||
warning("PAK file '%s' is corrupted", memberFile->getName().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ bool BaseFileManager::registerPackages() {
|
|||
for (Common::FSList::const_iterator it = _packagePaths.begin(); it != _packagePaths.end(); ++it) {
|
||||
debugC(kWintermuteDebugFileAccess, "Should register folder: %s %s", it->getPath().c_str(), it->getName().c_str());
|
||||
if (!it->getChildren(files, Common::FSNode::kListFilesOnly)) {
|
||||
warning("getChildren() failed for path: %s", it->getDisplayName().c_str());
|
||||
warning("getChildren() failed for path: %s", it->getName().c_str());
|
||||
}
|
||||
for (Common::FSList::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
|
||||
// To prevent any case sensitivity issues we make the filename
|
||||
|
|
|
@ -347,7 +347,7 @@ bool ThemeEngine::init() {
|
|||
if (member) {
|
||||
_themeArchive = Common::makeZipArchive(member->createReadStream());
|
||||
if (!_themeArchive) {
|
||||
warning("Failed to open Zip archive '%s'.", member->getDisplayName().c_str());
|
||||
warning("Failed to open Zip archive '%s'.", member->getName().c_str());
|
||||
}
|
||||
} else {
|
||||
_themeArchive = Common::makeZipArchive(node);
|
||||
|
@ -919,13 +919,13 @@ bool ThemeEngine::loadThemeXML(const Common::String &themeId) {
|
|||
assert((*i)->getName().hasSuffix(".stx"));
|
||||
|
||||
if (_parser->loadStream((*i)->createReadStream()) == false) {
|
||||
warning("Failed to load STX file '%s'", (*i)->getDisplayName().c_str());
|
||||
warning("Failed to load STX file '%s'", (*i)->getName().c_str());
|
||||
_parser->close();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_parser->parse() == false) {
|
||||
warning("Failed to parse STX file '%s'", (*i)->getDisplayName().c_str());
|
||||
warning("Failed to parse STX file '%s'", (*i)->getName().c_str());
|
||||
_parser->close();
|
||||
return false;
|
||||
}
|
||||
|
@ -1913,7 +1913,7 @@ void ThemeEngine::listUsableThemes(Common::Archive &archive, Common::List<ThemeD
|
|||
td.name.clear();
|
||||
if (themeConfigUsable(**i, td.name)) {
|
||||
td.filename = (*i)->getName();
|
||||
td.id = (*i)->getDisplayName();
|
||||
td.id = (*i)->getName();
|
||||
|
||||
// If the name of the node object also contains
|
||||
// the ".zip" suffix, we will strip it.
|
||||
|
|
|
@ -212,9 +212,9 @@ void BrowserDialog::updateListing() {
|
|||
ListWidget::ColorList colors;
|
||||
for (Common::FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) {
|
||||
if (i->isDirectory())
|
||||
list.push_back(i->getDisplayName() + "/");
|
||||
list.push_back(i->getName() + "/");
|
||||
else
|
||||
list.push_back(i->getDisplayName());
|
||||
list.push_back(i->getName());
|
||||
|
||||
if (_isDirBrowser) {
|
||||
if (i->isDirectory())
|
||||
|
|
|
@ -617,7 +617,7 @@ bool Debugger::cmdOpenLog(int argc, const char **argv) {
|
|||
#ifndef DISABLE_MD5
|
||||
struct ArchiveMemberLess {
|
||||
bool operator()(const Common::ArchiveMemberPtr &x, const Common::ArchiveMemberPtr &y) const {
|
||||
return (*x).getDisplayName().compareToIgnoreCase((*y).getDisplayName()) < 0;
|
||||
return (*x).getName().compareToIgnoreCase((*y).getName()) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -653,7 +653,7 @@ bool Debugger::cmdMd5(int argc, const char **argv) {
|
|||
for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) {
|
||||
Common::SeekableReadStream *stream = (*iter)->createReadStream();
|
||||
Common::String md5 = Common::computeStreamMD5AsString(*stream, length);
|
||||
debugPrintf("%s %s %d\n", md5.c_str(), (*iter)->getDisplayName().c_str(), (int32)stream->size());
|
||||
debugPrintf("%s %s %d\n", md5.c_str(), (*iter)->getName().c_str(), (int32)stream->size());
|
||||
delete stream;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue