From f6128a85b2531806e2ef01b6d0c6f5ffd68ec6f5 Mon Sep 17 00:00:00 2001 From: dteviot Date: Sun, 22 Feb 2015 13:48:44 +1300 Subject: [PATCH] resolve symlinks when searching for file's last modified time. --- apps/mwiniimporter/importer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index 6b8424da6..b71ebd2b8 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -883,15 +883,16 @@ void MwIniImporter::setInputEncoding(const ToUTF8::FromType &encoding) std::time_t MwIniImporter::lastWriteTime(const boost::filesystem::path& filename, std::time_t defaultTime) { std::time_t writeTime(defaultTime); - if (boost::filesystem::exists(filename)) + boost::filesystem::path resolved = boost::filesystem::canonical(filename); + if (boost::filesystem::exists(resolved)) { - writeTime = boost::filesystem::last_write_time(filename); - std::cout << "content file: " << filename << " timestamp = (" << writeTime << + writeTime = boost::filesystem::last_write_time(resolved); + std::cout << "content file: " << resolved << " timestamp = (" << writeTime << ") " << asctime(localtime(&writeTime)) << std::endl; } else { - std::cout << "content file: " << filename << " not found" << std::endl; + std::cout << "content file: " << resolved << " not found" << std::endl; } return writeTime; } \ No newline at end of file