diff Core/HttpServer/FilesystemHttpSender.cpp @ 217:1ac3aacd10a5

simplifications
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Nov 2012 12:22:23 +0100
parents de640de989b8
children 5459f05b4f54
line wrap: on
line diff
--- a/Core/HttpServer/FilesystemHttpSender.cpp	Thu Nov 29 11:57:35 2012 +0100
+++ b/Core/HttpServer/FilesystemHttpSender.cpp	Thu Nov 29 12:22:23 2012 +0100
@@ -39,14 +39,13 @@
 {
   void FilesystemHttpSender::Setup()
   {
-    boost::filesystem::path p(path_);
-    SetFilename(p.filename().string());
-    SetContentType(Toolbox::AutodetectMimeType(p.filename().string()));
+    //SetDownloadFilename(path_.filename().string());
+    SetContentType(Toolbox::AutodetectMimeType(path_.filename().string()));
   }
 
   uint64_t FilesystemHttpSender::GetFileSize()
   {
-    return Toolbox::GetFileSize(path_);
+    return Toolbox::GetFileSize(path_.string());
   }
 
   bool FilesystemHttpSender::SendData(HttpOutput& output)
@@ -77,8 +76,15 @@
     return true;
   }
 
-  FilesystemHttpSender::FilesystemHttpSender(const char* path) : path_(path)
+  FilesystemHttpSender::FilesystemHttpSender(const char* path)
   {
+    path_ = std::string(path);
+    Setup();
+  }
+
+  FilesystemHttpSender::FilesystemHttpSender(const boost::filesystem::path& path)
+  {
+    path_ = path;
     Setup();
   }