add missing runtime_error include and improperly located headers

This commit is contained in:
Thomas Fussell 2015-11-03 08:46:40 -05:00
parent 2c8ccdfcda
commit a2919dfed8
4 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,7 @@
#include <algorithm> #include <algorithm>
#include <stdexcept>
#include <xlnt/workbook/manifest.hpp> #include <xlnt/packaging/manifest.hpp>
namespace { namespace {

View File

@ -5,26 +5,29 @@
#include <string> #include <string>
#include <detail/include_windows.hpp> #include <detail/include_windows.hpp>
#include <helpers/path_helper.hpp>
#include "path_helper.hpp"
class TemporaryFile class TemporaryFile
{ {
public: public:
static std::string CreateTemporaryFilename() static std::string CreateTemporaryFilename()
{ {
#ifdef _WIN32 #ifdef _MSC_VER
std::array<TCHAR, MAX_PATH> buffer; std::array<TCHAR, MAX_PATH> buffer;
DWORD result = GetTempPath(static_cast<DWORD>(buffer.size()), buffer.data()); DWORD result = GetTempPath(static_cast<DWORD>(buffer.size()), buffer.data());
if(result > MAX_PATH) if(result > MAX_PATH)
{ {
throw std::runtime_error("buffer is too small"); throw std::runtime_error("buffer is too small");
} }
if(result == 0) if(result == 0)
{ {
throw std::runtime_error("GetTempPath failed"); throw std::runtime_error("GetTempPath failed");
} }
std::string directory(buffer.begin(), buffer.begin() + result); std::string directory(buffer.begin(), buffer.begin() + result);
return PathHelper::WindowsToUniversalPath(directory + "xlnt.xlsx"); return PathHelper::WindowsToUniversalPath(directory + "xlnt.xlsx");
#else #else
return "/tmp/xlnt.xlsx"; return "/tmp/xlnt.xlsx";