From cda81f606f12623149c69d432cb2a779a6092394 Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Thu, 29 Nov 2018 04:14:33 +0100 Subject: [PATCH] Enable to read remote UNC locations on windows --- src/file.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/file.cpp b/src/file.cpp index 778ce87ed..71b179251 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -81,7 +81,10 @@ namespace Sass { wchar_t resolved[32768]; // windows unicode filepaths are encoded in utf16 std::string abspath(join_paths(get_cwd(), path)); - std::wstring wpath(UTF_8::convert_to_utf16("\\\\?\\" + abspath)); + if (!(abspath[0] == '/' && abspath[1] == '/')) { + abspath = "//?/" + abspath; + } + std::wstring wpath(UTF_8::convert_to_utf16(abspath)); std::replace(wpath.begin(), wpath.end(), '/', '\\'); DWORD rv = GetFullPathNameW(wpath.c_str(), 32767, resolved, NULL); if (rv > 32767) throw Exception::OperationError("Path is too long"); @@ -434,7 +437,10 @@ namespace Sass { wchar_t resolved[32768]; // windows unicode filepaths are encoded in utf16 std::string abspath(join_paths(get_cwd(), path)); - std::wstring wpath(UTF_8::convert_to_utf16("\\\\?\\" + abspath)); + if (!(abspath[0] == '/' && abspath[1] == '/')) { + abspath = "//?/" + abspath; + } + std::wstring wpath(UTF_8::convert_to_utf16(abspath)); std::replace(wpath.begin(), wpath.end(), '/', '\\'); DWORD rv = GetFullPathNameW(wpath.c_str(), 32767, resolved, NULL); if (rv > 32767) throw Exception::OperationError("Path is too long");