Merge pull request #57116 from bruvzg/win_net_share

This commit is contained in:
Rémi Verschelde 2022-01-28 11:03:23 +01:00 committed by GitHub
commit 9686d680b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 69 additions and 16 deletions

View file

@ -165,8 +165,11 @@ Error DirAccessWindows::make_dir(String p_dir) {
bool success;
int err;
p_dir = "\\\\?\\" + p_dir; //done according to
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx
if (!p_dir.is_network_share_path()) {
p_dir = "\\\\?\\" + p_dir;
// Add "\\?\" to the path to extend max. path length past 248, if it's not a network share UNC path.
// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx
}
success = CreateDirectoryW((LPCWSTR)(p_dir.utf16().get_data()), nullptr);
err = GetLastError();
@ -349,6 +352,10 @@ String DirAccessWindows::get_filesystem_type() const {
ERR_FAIL_COND_V(unit_end == -1, String());
String unit = path.substr(0, unit_end + 1) + "\\";
if (path.is_network_share_path()) {
return "Network Share";
}
WCHAR szVolumeName[100];
WCHAR szFileSystemName[10];
DWORD dwSerialNumber = 0;