From 39bf5d6b8a9de019f63be5575bc887487df8bf17 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Wed, 10 Jan 2018 10:03:56 +0100 Subject: [PATCH] Add-ons: add fallback code for compilers without working This is another place where the add-on code uses regexps, and so far I had forgotten to add the fallback code for compilers that don't support as per the C++11 standard. --- src/Add-ons/AddonMetadataParser.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Add-ons/AddonMetadataParser.cxx b/src/Add-ons/AddonMetadataParser.cxx index 9ee01b598..d17ec402e 100644 --- a/src/Add-ons/AddonMetadataParser.cxx +++ b/src/Add-ons/AddonMetadataParser.cxx @@ -338,11 +338,19 @@ Addon::MetadataParser::parseLicenseNode(const SGPath& addonPath, "however it starts with '" + licenseFile_s[0] + "'"); } +#ifdef HAVE_WORKING_STD_REGEX std::regex winDriveRegexp("([a-zA-Z]:).*"); std::smatch results; if (std::regex_match(licenseFile_s, results, winDriveRegexp)) { string winDrive = results.str(1); +#else // all this 'else' clause should be removed once we actually require C++11 + if (licenseFile_s.size() >= 2 && + (('a' <= licenseFile_s[0] && licenseFile_s[0] <= 'z') || + ('A' <= licenseFile_s[0] && licenseFile_s[0] <= 'Z')) && + licenseFile_s[1] == ':') { + string winDrive = licenseFile_s.substr(0, 2); +#endif throw errors::error_loading_metadata_file( "in add-on metadata file '" + metadataFile.utf8Str() + "': the " "value of /addon/license/file must be relative to the add-on folder, "