diff options
-rw-r--r-- | gentoobrowse-api/service/fileUtils.cpp | 12 | ||||
-rw-r--r-- | gentoobrowse-api/service/fileUtils.h | 6 |
2 files changed, 9 insertions, 9 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()); } } diff --git a/gentoobrowse-api/service/fileUtils.h b/gentoobrowse-api/service/fileUtils.h index c9a2ec4..b447c4d 100644 --- a/gentoobrowse-api/service/fileUtils.h +++ b/gentoobrowse-api/service/fileUtils.h @@ -12,7 +12,7 @@ namespace Gentoo { class FileHandle { public: - FileHandle(const std::string & path); + FileHandle(const boost::filesystem::path & path); ~FileHandle(); protected: @@ -21,7 +21,7 @@ namespace Gentoo { class FileHandleStat : public FileHandle { public: - FileHandleStat(const std::string & path); + FileHandleStat(const boost::filesystem::path & path); protected: struct stat st; @@ -29,7 +29,7 @@ namespace Gentoo { class MemMap : public FileHandleStat { public: - MemMap(const std::string & path); + MemMap(const boost::filesystem::path & path); ~MemMap(); protected: |