Skip to content

Commit c29a774

Browse files
authored
Merge pull request #2771 from mgreter/feature/remote-win-unc-locations
Fix for remote win unc locations
2 parents c450582 + cda81f6 commit c29a774

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/file.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ namespace Sass {
8181
wchar_t resolved[32768];
8282
// windows unicode filepaths are encoded in utf16
8383
std::string abspath(join_paths(get_cwd(), path));
84-
std::wstring wpath(UTF_8::convert_to_utf16("\\\\?\\" + abspath));
84+
if (!(abspath[0] == '/' && abspath[1] == '/')) {
85+
abspath = "//?/" + abspath;
86+
}
87+
std::wstring wpath(UTF_8::convert_to_utf16(abspath));
8588
std::replace(wpath.begin(), wpath.end(), '/', '\\');
8689
DWORD rv = GetFullPathNameW(wpath.c_str(), 32767, resolved, NULL);
8790
if (rv > 32767) throw Exception::OperationError("Path is too long");
@@ -434,7 +437,10 @@ namespace Sass {
434437
wchar_t resolved[32768];
435438
// windows unicode filepaths are encoded in utf16
436439
std::string abspath(join_paths(get_cwd(), path));
437-
std::wstring wpath(UTF_8::convert_to_utf16("\\\\?\\" + abspath));
440+
if (!(abspath[0] == '/' && abspath[1] == '/')) {
441+
abspath = "//?/" + abspath;
442+
}
443+
std::wstring wpath(UTF_8::convert_to_utf16(abspath));
438444
std::replace(wpath.begin(), wpath.end(), '/', '\\');
439445
DWORD rv = GetFullPathNameW(wpath.c_str(), 32767, resolved, NULL);
440446
if (rv > 32767) throw Exception::OperationError("Path is too long");

0 commit comments

Comments
 (0)