diff options
Diffstat (limited to 'gentoobrowse-api/service/fileUtils.cpp')
-rw-r--r-- | gentoobrowse-api/service/fileUtils.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gentoobrowse-api/service/fileUtils.cpp b/gentoobrowse-api/service/fileUtils.cpp index 05f797f..c9bcc34 100644 --- a/gentoobrowse-api/service/fileUtils.cpp +++ b/gentoobrowse-api/service/fileUtils.cpp @@ -14,11 +14,11 @@ namespace Gentoo { } } - FileHandle::FileHandle(const std::string & path) : + FileHandle::FileHandle(const boost::filesystem::path & path) : fh(open(path.c_str(), O_RDONLY)) { if (fh < 0) { - throw std::runtime_error("Failed to open " + path); + throw std::runtime_error("Failed to open " + path.string()); } } @@ -27,20 +27,20 @@ namespace Gentoo { close(fh); } - FileHandleStat::FileHandleStat(const std::string & path) : + FileHandleStat::FileHandleStat(const boost::filesystem::path & path) : FileHandle(path) { if (fstat(fh, &st)) { - throw std::runtime_error("Failed to stat " + path); + throw std::runtime_error("Failed to stat " + path.string()); } } - MemMap::MemMap(const std::string & path) : + MemMap::MemMap(const boost::filesystem::path & path) : FileHandleStat(path), data(mmap(0, st.st_size, PROT_READ, MAP_SHARED, fh, 0)) { if (data == (void*)-1) { - throw std::runtime_error("Failed to mmap " + path); + throw std::runtime_error("Failed to mmap " + path.string()); } } |