#include <sstream>
#include <stdexcept>
+#include <algorithm>
#include <cstdlib>
#include <list>
#include <physfs.h>
#include <sys/stat.h>
#include <stdio.h>
#include "addon/addon_manager.hpp"
+#include "addon/addon.hpp"
#include "config.h"
#include "log.hpp"
#include "lisp/parser.hpp"
#include "lisp/lisp.hpp"
#include "lisp/list_iterator.hpp"
+#include "lisp/writer.hpp"
#include "physfs/physfs_stream.hpp"
#ifdef HAVE_LIBCURL
// get filename of potential archive
std::string fileName = *i;
- static const std::string archiveDir = PHYSFS_getRealDir(fileName.c_str());
+ const std::string archiveDir = PHYSFS_getRealDir(fileName.c_str());
static const std::string dirSep = PHYSFS_getDirSeparator();
std::string fullFilename = archiveDir + dirSep + fileName;
// make sure it looks like an infoFile
static const std::string infoExt = ".nfo";
- if (potentialInfoFileName.compare(potentialInfoFileName.length()-infoExt.length(), infoExt.length(), infoExt) != 0) continue;
+ if (potentialInfoFileName.length() <= infoExt.length())
+ continue;
+
+ if (potentialInfoFileName.compare(potentialInfoFileName.length()-infoExt.length(), infoExt.length(), infoExt) != 0)
+ continue;
// make sure it's in the current archive
std::string infoFileDir = PHYSFS_getRealDir(potentialInfoFileName.c_str());