Commit e842321b authored by Aloshi's avatar Aloshi

Removed dependency on libboost-regex.

It was kind of silly to pull in the entire lib for exactly one regular expression.
parent 8608ecc9
......@@ -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)
......
......@@ -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:
......
#include "FileData.h"
#include <boost/regex/v4/regex.hpp>
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;
}
......
#include <iostream>
#include "HttpReq.h"
#include <boost/bind.hpp>
#include "Log.h"
#include <boost/filesystem.hpp>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment