1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

[Windows, 3.x] Add support for handling network share paths.

This commit is contained in:
bruvzg
2022-06-13 09:20:40 +03:00
parent cda6ea06f9
commit 11a7997a67
8 changed files with 69 additions and 15 deletions

View File

@@ -159,8 +159,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(p_dir.c_str(), NULL);
err = GetLastError();
@@ -344,6 +347,10 @@ uint64_t DirAccessWindows::get_space_left() {
String DirAccessWindows::get_filesystem_type() const {
String path = fix_path(const_cast<DirAccessWindows *>(this)->get_current_dir());
if (path.is_network_share_path()) {
return "Network Share";
}
int unit_end = path.find(":");
ERR_FAIL_COND_V(unit_end == -1, String());
String unit = path.substr(0, unit_end + 1) + "\\";