summaryrefslogtreecommitdiff
path: root/drivers/windows
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-01-21 15:23:08 -0300
committerJuan Linietsky <reduzio@gmail.com>2019-01-21 18:06:14 -0300
commit6fa632b82121aff5537d627364d2f10fdeafc418 (patch)
tree892a2f4028268c3b0918b0b23716a43369725a78 /drivers/windows
parent100154a1319ef6b6772bb27612f5329204a68798 (diff)
Add function to obtain filesystem type from DirAccess.
Change EditorFileSystem to not use directory modification times on FAT32, fixes #20946
Diffstat (limited to 'drivers/windows')
-rw-r--r--drivers/windows/dir_access_windows.cpp29
-rw-r--r--drivers/windows/dir_access_windows.h3
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index c20f707684..c32e063736 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -346,6 +346,35 @@ size_t DirAccessWindows::get_space_left() {
return (size_t)bytes;
}
+String DirAccessWindows::get_filesystem_type() const {
+ String path = fix_path(const_cast<DirAccessWindows*>(this)->get_current_dir());
+ print_line("fixed path: "+path);
+ int unit_end = path.find(":");
+ ERR_FAIL_COND_V(unit_end==-1,String());
+ String unit = path.substr(0,unit_end+1) + "\\";
+ print_line("unit: "+unit);
+
+ TCHAR szVolumeName[100] = "";
+ TCHAR szFileSystemName[10] = "";
+ DWORD dwSerialNumber = 0;
+ DWORD dwMaxFileNameLength = 0;
+ DWORD dwFileSystemFlags = 0;
+
+ if(::GetVolumeInformation(unit.utf8().get_data(),
+ szVolumeName,
+ sizeof(szVolumeName),
+ &dwSerialNumber,
+ &dwMaxFileNameLength,
+ &dwFileSystemFlags,
+ szFileSystemName,
+ sizeof(szFileSystemName)) == TRUE) {
+
+ return String(szFileSystemName);
+ }
+
+ ERR_FAIL_V("");
+}
+
DirAccessWindows::DirAccessWindows() {
p = memnew(DirAccessWindowsPrivate);
diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h
index 2e2d23f4e2..b8599d5c26 100644
--- a/drivers/windows/dir_access_windows.h
+++ b/drivers/windows/dir_access_windows.h
@@ -82,6 +82,9 @@ public:
//virtual FileType get_file_type() const;
size_t get_space_left();
+ virtual String get_filesystem_type() const;
+
+
DirAccessWindows();
~DirAccessWindows();
};