diff options
-rw-r--r-- | core/io/file_access_pack.cpp | 4 | ||||
-rw-r--r-- | core/io/file_access_pack.h | 3 | ||||
-rw-r--r-- | core/os/dir_access.h | 1 | ||||
-rw-r--r-- | drivers/unix/dir_access_unix.cpp | 4 | ||||
-rw-r--r-- | drivers/unix/dir_access_unix.h | 3 | ||||
-rw-r--r-- | drivers/windows/dir_access_windows.cpp | 29 | ||||
-rw-r--r-- | drivers/windows/dir_access_windows.h | 3 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 6 | ||||
-rw-r--r-- | editor/editor_file_system.h | 2 | ||||
-rw-r--r-- | platform/android/dir_access_jandroid.cpp | 6 | ||||
-rw-r--r-- | platform/android/dir_access_jandroid.h | 2 |
11 files changed, 62 insertions, 1 deletions
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 43fedc5238..c97b8cafac 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -490,6 +490,10 @@ size_t DirAccessPack::get_space_left() { return 0; } +String DirAccessPack::get_filesystem_type() const { + return "PCK"; +} + DirAccessPack::DirAccessPack() { current = PackedData::get_singleton()->root; diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 04610bed57..ae5e83d405 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -221,6 +221,9 @@ public: size_t get_space_left(); + virtual String get_filesystem_type() const; + + DirAccessPack(); ~DirAccessPack(); }; diff --git a/core/os/dir_access.h b/core/os/dir_access.h index 16358fbc57..36ccbc9b4d 100644 --- a/core/os/dir_access.h +++ b/core/os/dir_access.h @@ -98,6 +98,7 @@ public: virtual Error rename(String p_from, String p_to) = 0; virtual Error remove(String p_name) = 0; + virtual String get_filesystem_type() const=0 ; static String get_full_path(const String &p_path, AccessType p_access); static DirAccess *create_for_path(const String &p_path); diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index 7284226ae7..e011176806 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -407,6 +407,10 @@ size_t DirAccessUnix::get_space_left() { #endif }; +String DirAccessUnix::get_filesystem_type() const { + return ""; //TODO this should be implemented +} + DirAccessUnix::DirAccessUnix() { dir_stream = 0; diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h index 4da7e42b64..b85ae719ff 100644 --- a/drivers/unix/dir_access_unix.h +++ b/drivers/unix/dir_access_unix.h @@ -82,6 +82,9 @@ public: virtual size_t get_space_left(); + virtual String get_filesystem_type() const; + + DirAccessUnix(); ~DirAccessUnix(); }; 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(); }; diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 5d8903a554..d958ecebf6 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -797,7 +797,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const bool updated_dir = false; String cd = p_dir->get_path(); - if (current_mtime != p_dir->modified_time) { + if (current_mtime != p_dir->modified_time || using_fat_32) { updated_dir = true; p_dir->modified_time = current_mtime; @@ -1809,10 +1809,14 @@ EditorFileSystem::EditorFileSystem() { if (da->change_dir("res://.import") != OK) { da->make_dir("res://.import"); } + //this should probably also work on Unix and use the string it returns for FAT32 + using_fat_32 = da->get_filesystem_type()=="FAT32"; memdelete(da); scan_total = 0; update_script_classes_queued = false; + + } EditorFileSystem::~EditorFileSystem() { diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index c18957ae99..bb892baf57 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -231,6 +231,8 @@ class EditorFileSystem : public Node { static Error _resource_import(const String &p_path); + bool using_fat_32; //workaround for projects in FAT32 filesystem (pendrives, most of the time) + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index af31c758ee..62cc7a380f 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -212,6 +212,12 @@ Error DirAccessJAndroid::remove(String p_name) { ERR_FAIL_V(ERR_UNAVAILABLE); } +String DirAccessJAndroid::get_filesystem_type() const { + + return "APK"; +} + + //FileType get_file_type() const; size_t DirAccessJAndroid::get_space_left() { diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h index 1d989dd35e..e7a2d5ada1 100644 --- a/platform/android/dir_access_jandroid.h +++ b/platform/android/dir_access_jandroid.h @@ -75,6 +75,8 @@ public: virtual Error rename(String p_from, String p_to); virtual Error remove(String p_name); + virtual String get_filesystem_type() const; + //virtual FileType get_file_type() const; size_t get_space_left(); |