diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f4b1e168..3ab3b2948 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ endif() find_package(Freetype REQUIRED) find_package(FreeImage REQUIRED) find_package(SDL2 REQUIRED) -find_package(Boost REQUIRED COMPONENTS system filesystem regex date_time) +find_package(Boost REQUIRED COMPONENTS system filesystem date_time) find_package(Eigen3 REQUIRED) find_package(CURL REQUIRED) diff --git a/README.md b/README.md index c68daaf24..a3d1829eb 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,12 @@ Building EmulationStation uses some C++11 code, which means you'll need to install at least g++-4.7 on Linux, or VS2010 on Windows. For installing and switching to g++-4.7 see [here](http://lektiondestages.blogspot.de/2013/05/installing-and-switching-gccg-versions.html). You can also just use `export CXX=g++-4.7` to explicitly specify the compiler for CMake (make sure you delete your CMake cache files if it's not working). -EmulationStation has a few dependencies. For building, you'll need SDL2, Boost (System, Filesystem, Regex, DateTime), FreeImage, FreeType, Eigen3, and cURL. +EmulationStation has a few dependencies. For building, you'll need SDL2, Boost (System, Filesystem, DateTime), FreeImage, FreeType, Eigen3, and cURL. **On Linux:** All of this be easily installed with apt-get: ```bash -sudo apt-get install libsdl2-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libboost-date-time-dev libfreeimage-dev libfreetype6-dev libeigen3-dev libcurl-dev libasound2-dev +sudo apt-get install libsdl2-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-date-time-dev libfreeimage-dev libfreetype6-dev libeigen3-dev libcurl-dev libasound2-dev ``` Unless you're on the Raspberry Pi, you'll also need OpenGL: diff --git a/src/FileData.cpp b/src/FileData.cpp index 710313f85..0c7c652d2 100644 --- a/src/FileData.cpp +++ b/src/FileData.cpp @@ -1,11 +1,36 @@ #include "FileData.h" -#include namespace fs = boost::filesystem; std::string getCleanFileName(const fs::path& path) { - return regex_replace(path.stem().generic_string(), boost::regex("\\((.*)\\)|\\[(.*)\\]"), ""); + // remove anything in parenthesis or brackets + // should be roughly equivalent to the regex replace "\((.*)\)|\[(.*)\]" with "" + // I would love to just use regex, but it's not worth pulling in another boost lib for one function that is used once + + std::string ret = path.stem().generic_string(); + size_t start, end; + + static const int NUM_TO_REPLACE = 2; + static const char toReplace[NUM_TO_REPLACE*2] = { '(', ')', '[', ']' }; + + bool done = false; + while(!done) + { + done = true; + for(int i = 0; i < NUM_TO_REPLACE; i++) + { + start = ret.find(toReplace[i*2]); + end = ret.find(toReplace[i*2+1], start != std::string::npos ? start + 1 : 0); + if(start != std::string::npos && end != std::string::npos) + { + ret.replace(start, end, ""); + done = false; + } + } + } + + return ret; } diff --git a/src/HttpReq.cpp b/src/HttpReq.cpp index 05423dfa0..5171da636 100644 --- a/src/HttpReq.cpp +++ b/src/HttpReq.cpp @@ -1,6 +1,5 @@ #include #include "HttpReq.h" -#include #include "Log.h" #include