From 0da23959740a99f31a45262e9be9331327cac589 Mon Sep 17 00:00:00 2001 From: NH Date: Sun, 19 Oct 2025 14:19:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=B8=BAstd::filesystem=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E8=8E=B7=E5=8F=96=E6=96=87=E4=BB=B6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/net/http_response.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/net/http_response.cpp b/src/net/http_response.cpp index 3ccf37e..beb0f67 100644 --- a/src/net/http_response.cpp +++ b/src/net/http_response.cpp @@ -31,6 +31,7 @@ If you have any questions, please contact us: 1585346868@qq.com Or visit our web #include "net/http_router.h" #include "net/http_website.h" #include +#include #define HPSERVER ((IHttpServer*)m_reqpack->server()->hpserver()) #ifdef MSVC_2010 #define HEADER_SET(NAME,VALUE) m_headers.insert(std::pair(NAME,VALUE)) @@ -150,13 +151,19 @@ bool ylib::network::http::response::send_file(const std::string& filepath, int32 //ylib::log->info(filepath2,"response"); //取文件信息 - { + /*{ struct _stat64 statbuf; if (_stat64(filepath2.c_str(), &statbuf) != 0) return false; filesize = statbuf.st_size; last_modify_time = statbuf.st_mtime; + }*/ + { + auto filesize = std::filesystem::file_size(filepath2); + auto ftime =std::filesystem::last_write_time(filepath2); + auto sctp = std::chrono::clock_cast(ftime); + last_modify_time = std::chrono::system_clock::to_time_t(sctp); } // 设置为已发送 m_response = true;