Fix command line parsing on Windows

This commit is contained in:
Sebastian Messmer 2018-08-07 18:10:53 -07:00
parent 76969171c7
commit 70096de4e3

View File

@ -13,8 +13,8 @@ namespace cryfs {
auto doubleDashIterator = std::find(options.begin(), options.end(), string("--")); auto doubleDashIterator = std::find(options.begin(), options.end(), string("--"));
vector<string> beforeDoubleDash(options.begin(), doubleDashIterator); vector<string> beforeDoubleDash(options.begin(), doubleDashIterator);
vector<string> afterDoubleDash; vector<string> afterDoubleDash;
afterDoubleDash.reserve(options.size()-beforeDoubleDash.size()); if (doubleDashIterator != options.end() && doubleDashIterator + 1 != options.end()) {
if (options.end() >= doubleDashIterator+1) { afterDoubleDash.reserve(options.size() - beforeDoubleDash.size() - 1);
std::copy(doubleDashIterator + 1, options.end(), std::back_inserter(afterDoubleDash)); std::copy(doubleDashIterator + 1, options.end(), std::back_inserter(afterDoubleDash));
} }
return make_pair( return make_pair(