Simplified some path writes

This commit is contained in:
emeric
2025-01-06 22:29:46 +01:00
parent 06a4db51f7
commit 10d900faf2
25 changed files with 59 additions and 65 deletions
+4 -4
View File
@@ -39,13 +39,13 @@ namespace lms
Wt::Http::ResponseContinuation* FileResourceHandler::processRequest(const Wt::Http::Request& request, Wt::Http::Response& response)
{
::uint64_t startByte{ _offset };
std::ifstream ifs{ _path.string().c_str(), std::ios::in | std::ios::binary };
std::ifstream ifs{ _path, std::ios::in | std::ios::binary };
if (startByte == 0)
{
if (!ifs)
{
LMS_LOG(UTILS, ERROR, "Cannot open file stream for '" << _path.string() << "'");
LMS_LOG(UTILS, ERROR, "Cannot open file stream for " << _path);
response.setStatus(404);
return {};
}
@@ -54,7 +54,7 @@ namespace lms
const ::uint64_t fileSize{ static_cast<::uint64_t>(ifs.tellg()) };
ifs.seekg(0, std::ios::beg);
LMS_LOG(UTILS, DEBUG, "File '" << _path.string() << "', fileSize = " << fileSize);
LMS_LOG(UTILS, DEBUG, "File " << _path << ", fileSize = " << fileSize);
response.addHeader("Accept-Ranges", "bytes");
@@ -99,7 +99,7 @@ namespace lms
}
else if (!ifs)
{
LMS_LOG(UTILS, ERROR, "Cannot reopen file stream for '" << _path.string() << "'");
LMS_LOG(UTILS, ERROR, "Cannot reopen file stream for " << _path);
return {};
}