Closed DavisVaughan closed 2 years ago
Btw. I think it would make sense to test this on Solaris, and also on a non-UTF-8 Linux, e.g. R-hub has an image, before the release.
Passing with the test on both Solaris and debian-clang-devel https://builder.r-hub.io/status/tzdb_0.1.2.9000.tar.gz-c681d4eaa6404f87a8b9cadb5406b0d3 https://builder.r-hub.io/status/tzdb_0.1.2.9000.tar.gz-599121d923d842f6b73e346ecb967eeb
Closes #10
This is a minimal ish patch to get date to work with wide character file paths on Windows when one is supplied as the install destination through
set_install(const std::string& path)
.It mainly required two things:
A
to_utf16()
converter to convert fromstd::string
tostd::wstring
A subclass of
std::streambuf
that can stream from aFILE*
, that we can then use instd::istream
. This is explained more in the code, but essentiallystd::ifstream
's constructor does not allow wide character file paths to stream from, so we have to create our own file streambuf class that can open wide character file paths, and then use that instd::istream
.I don't understand all the details of the streambuf class, but it seems to be working?
Once we have those two helpers, we just use them any time we have to access the path provided by
set_install()
.