Add function to obtain filesystem type from DirAccess.

Change EditorFileSystem to not use directory modification times on FAT32, fixes #20946
This commit is contained in:
Juan Linietsky
2019-01-21 15:23:08 -03:00
parent 100154a131
commit 6fa632b821
11 changed files with 62 additions and 1 deletions

View File

@ -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);

View File

@ -82,6 +82,9 @@ public:
//virtual FileType get_file_type() const;
size_t get_space_left();
virtual String get_filesystem_type() const;
DirAccessWindows();
~DirAccessWindows();
};