* @brief Checks if file has changed since last update (save or rescan). * @param [in] szPath File to check * @param [in] dfi Previous fileinfo of file * @param [in] bSave If true Compare to last save-info, else to rescan-info * @param [in] nBuffer Index (0-based) of buffer * @return true if file is changed. */
| 1738 | * @return true if file is changed. |
| 1739 | */ |
| 1740 | CMergeDoc::FileChange CMergeDoc::IsFileChangedOnDisk(const tchar_t* szPath, DiffFileInfo &dfi, |
| 1741 | bool bSave, int nBuffer) |
| 1742 | { |
| 1743 | DiffFileInfo *fileInfo = nullptr; |
| 1744 | bool bFileChanged = false; |
| 1745 | bool bIgnoreSmallDiff = GetOptionsMgr()->GetBool(OPT_IGNORE_SMALL_FILETIME); |
| 1746 | int tolerance = 0; |
| 1747 | if (bIgnoreSmallDiff) |
| 1748 | tolerance = SmallTimeDiff; // From MainFrm.h |
| 1749 | |
| 1750 | if (bSave) |
| 1751 | fileInfo = m_pSaveFileInfo[nBuffer].get(); |
| 1752 | else |
| 1753 | fileInfo = m_pRescanFileInfo[nBuffer].get(); |
| 1754 | |
| 1755 | // We assume file existed, so disappearing means removal |
| 1756 | if (!dfi.Update(szPath)) |
| 1757 | return FileChange::Removed; |
| 1758 | |
| 1759 | int64_t timeDiff = dfi.mtime - fileInfo->mtime; |
| 1760 | if (timeDiff < 0) timeDiff = -timeDiff; |
| 1761 | if ((timeDiff > tolerance * Poco::Timestamp::resolution()) || (dfi.size != fileInfo->size)) |
| 1762 | { |
| 1763 | bFileChanged = true; |
| 1764 | } |
| 1765 | |
| 1766 | if (bFileChanged) |
| 1767 | return FileChange::Changed; |
| 1768 | else |
| 1769 | return FileChange::NoChange; |
| 1770 | } |
| 1771 | |
| 1772 | void CMergeDoc::HideLines() |
| 1773 | { |
no test coverage detected