From 8567f1a997d36fcd32faf7da0b7ae6a1f9f86bed Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Tue, 18 Feb 2014 18:11:59 +1100 Subject: stream_file: cache remote files on Windows Same as 6896469 but for Windows. --- stream/stream_file.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'stream/stream_file.c') diff --git a/stream/stream_file.c b/stream/stream_file.c index 570546db19..9d22bd5539 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -39,6 +39,10 @@ #include #endif +#ifdef __MINGW32__ +#include +#endif + struct priv { int fd; bool close; @@ -126,6 +130,19 @@ static bool check_stream_network(stream_t *stream) return false; } +#elif defined(__MINGW32__) +static bool check_stream_network(stream_t *stream) +{ + wchar_t volume[MAX_PATH]; + wchar_t *path = mp_from_utf8(NULL, stream->path); + bool remote = false; + + if (GetVolumePathNameW(path, volume, MAX_PATH)) + remote = GetDriveTypeW(volume) == DRIVE_REMOTE; + + talloc_free(path); + return remote; +} #else static bool check_stream_network(stream_t *stream) { -- cgit v1.2.3