Skip to content

Commit

Permalink
Merge pull request sass#2771 from mgreter/feature/remote-win-unc-loca…
Browse files Browse the repository at this point in the history
…tions

Fix for remote win unc locations
  • Loading branch information
mgreter authored Nov 29, 2018
2 parents c450582 + cda81f6 commit c29a774
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit c29a774

Please sign in to comment.