diff options
Diffstat (limited to 'cpp/src/IcePatch2/Util.cpp')
-rw-r--r-- | cpp/src/IcePatch2/Util.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp index 1614b1e8fbc..d0b62270d5d 100644 --- a/cpp/src/IcePatch2/Util.cpp +++ b/cpp/src/IcePatch2/Util.cpp @@ -756,24 +756,40 @@ IcePatch2::loadFileInfoSeq(const string& pa, FileInfoSeq& infoSeq) } } + bool save = false; + { const string pathLog = normalize(pa + ".log"); ifstream is(pathLog.c_str()); - while(is.good()) + if(is) { - FileInfo info; - is >> info; - - if(is.good()) + save = true; + + while(is.good()) { - infoSeq.push_back(info); + FileInfo info; + is >> info; + + if(is.good()) + { + infoSeq.push_back(info); + } } } } sort(infoSeq.begin(), infoSeq.end(), FileInfoLess()); infoSeq.erase(unique(infoSeq.begin(), infoSeq.end(), FileInfoEqual()), infoSeq.end()); + + // + // If we merged the sequence with a log file, we save this new + // merged sequence and remove the log file. + // + if(save) + { + saveFileInfoSeq(pa, infoSeq); + } } void |