summaryrefslogtreecommitdiff
path: root/drivers/windows
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-01-24 13:12:46 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-01-24 16:22:59 +0200
commitcba82805156ada29993d18b4ceb0721636a3db80 (patch)
tree25e189aeaf622d0f27889019e0f9977d290e37e5 /drivers/windows
parent6a3ff8fa1f2cbad5752cf039827206ac265f68f6 (diff)
[Windows] Add support for handling network share paths.
Diffstat (limited to 'drivers/windows')
-rw-r--r--drivers/windows/dir_access_windows.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index 6cd21b5615..6f3bad12c1 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -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;