mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-22 00:14:55 -05:00
Fix building untwine on MinGW-w64
This commit is contained in:
parent
860494865e
commit
43b4b54336
40
external/untwine/untwine/mingw/dirlist.hpp
vendored
40
external/untwine/untwine/mingw/dirlist.hpp
vendored
@ -1 +1,39 @@
|
||||
#include "../generic/dirlist.hpp"
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include <stringconv.hpp>
|
||||
|
||||
namespace untwine
|
||||
{
|
||||
namespace os
|
||||
{
|
||||
|
||||
// PDAL's directoryList had a bug, so we've imported a working
|
||||
// version here so that we can still use older PDAL releases.
|
||||
|
||||
inline std::vector<std::string> directoryList(const std::string& dir)
|
||||
{
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
std::vector<std::string> files;
|
||||
|
||||
try
|
||||
{
|
||||
fs::directory_iterator it(toNative(dir));
|
||||
fs::directory_iterator end;
|
||||
while (it != end)
|
||||
{
|
||||
files.push_back(fromNative(it->path().string()));
|
||||
it++;
|
||||
}
|
||||
}
|
||||
catch (fs::filesystem_error&)
|
||||
{
|
||||
files.clear();
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
} // namespace os
|
||||
} // namespace untwine
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <stringconv.hpp>
|
||||
|
||||
namespace untwine
|
||||
{
|
||||
@ -30,7 +34,7 @@ public:
|
||||
HANDLE m_handle;
|
||||
};
|
||||
|
||||
MapContext mapFile(const std::string& filename, bool readOnly, size_t pos, size_t size)
|
||||
inline MapContext mapFile(const std::string& filename, bool readOnly, size_t pos, size_t size)
|
||||
{
|
||||
MapContext ctx;
|
||||
|
||||
@ -61,7 +65,7 @@ MapContext mapFile(const std::string& filename, bool readOnly, size_t pos, size_
|
||||
return ctx;
|
||||
}
|
||||
|
||||
MapContext unmapFile(MapContext ctx)
|
||||
inline MapContext unmapFile(MapContext ctx)
|
||||
{
|
||||
if (UnmapViewOfFile(ctx.m_addr) == 0)
|
||||
ctx.m_error = "Couldn't unmap file.";
|
||||
Loading…
x
Reference in New Issue
Block a user