Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Commit

Permalink
ImageFilm load, fix failing load when compiling with GCC v4.8.4
Browse files Browse the repository at this point in the history
Apparently GCC v4.8.4, even when advertised as C++11 complete and building correctly while using std::regex, apparently regex support is not correct until v4.9 :-(
This was causing ImageFilm load to fail when compiling with gcc v4.8.4
http://stackoverflow.com/questions/20027305/strange-results-when-using-c11-regexp-with-gcc-4-8-2-but-works-with-boost-reg

So, to keep backwards compatibility with slightly older distros I had to remove any usage of std::regex and do the filename/extension comparisons manually
  • Loading branch information
DavidBluecame committed Jul 22, 2016
1 parent 6286b91 commit e71f0ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/yafraycore/imagefilm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <stdexcept>
#include <iomanip>
#include <utility>
#include <regex>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/filesystem.hpp>
Expand Down Expand Up @@ -1284,7 +1283,6 @@ void imageFilm_t::imageFilmLoadAllInFolder()
std::string parentPath = boost::filesystem::path(session.getPathImageOutput()).parent_path().string();
if(parentPath.empty()) parentPath = "."; //If parent path is empty, set the path to the current folder
const std::string target_path( parentPath );
const std::regex filmFilter(baseImageFileName + ".*\\.film$");
std::vector<std::string> filmFilesList;

try
Expand All @@ -1293,7 +1291,9 @@ void imageFilm_t::imageFilmLoadAllInFolder()
for(boost::filesystem::directory_iterator it( target_path ); it != it_end; ++it)
{
if(!boost::filesystem::is_regular_file(it->status())) continue;
if(!std::regex_match(it->path().filename().string(), filmFilter)) continue;
if(it->path().extension().string() != ".film") continue;
if(it->path().stem().string().size() < baseImageFileName.size()) continue;
if(it->path().stem().string().compare(0, baseImageFileName.size(), baseImageFileName) != 0) continue;
filmFilesList.push_back(it->path().string());
}
std::sort(filmFilesList.begin(), filmFilesList.end());
Expand Down

0 comments on commit e71f0ad

Please sign in to comment.